Excel COUNTIF: Count Cells Containing Specific Letters
Question details
Count cells containing selected letters anywhere in their text.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to count text cells containing letters such as s, a, or f.
- Observed behavior
- The desired result is a count of cells containing each selected letter, or a count of cells containing any of the selected letters.
Identify the range to search and decide whether you need a separate count for each letter or one combined count. In the examples below, the text is in A3:A9.
Use COUNTIF wildcards to count each letter
Use this method to get a separate count for each selected letter, regardless of where it appears in a cell.
Enter s in B2, a in C2, and f in D2. Keep the text to search in A3:A9.
Select B3 and enter =COUNTIF($A$3:$A$9,"*"&B$2&"*"). The asterisks match text before and after the letter in B2.
Drag the fill handle from B3 across to D3. Each formula counts cells containing the letter in the header above it.

Count cells containing any selected letter once
Use this method for one combined count when a cell may contain more than one of the selected letters.
Count cells containing letters in WPS Spreadsheets
Use COUNTIF and wildcard characters in WPS Spreadsheets to count cells containing a selected letter anywhere in their text.
- 1. Open your spreadsheet: Open WPS Spreadsheets and use Open to select your workbook.
- 2. Add target letters: Enter the letters to count in B2, C2, and D2, with the text to search in A3:A9.
- 3. Enter COUNTIF: Select B3 and enter =COUNTIF($A$3:$A$9,"*"&B$2&"*"). Press Enter.
- 4. Count the other letters: Drag the fill handle from B3 across to D3 to calculate a separate count for each letter.

Frequently Asked Questions
Does COUNTIF distinguish between uppercase and lowercase letters?
No. COUNTIF is not case-sensitive, so a search for s also matches S.
Why does the formula use an asterisk on each side of the letter?
In =COUNTIF(A3:A9,"*s*"), each asterisk matches any number of characters. This allows s to appear at the beginning, middle, or end of the cell text.
Can I add the counts for s, a, and f to get one total?
Adding the separate COUNTIF results can count a cell more than once if it contains multiple target letters. Use the SUMPRODUCT and SEARCH formula above to count each matching cell once.
How do I search a different range?
Replace $A$3:$A$9 in the COUNTIF formula with your range, such as $C$2:$C$100. Keep the dollar signs if you want the range to stay fixed when copying the formula.




