Excel: Count How Many Cells Have Text
In this article
To count how many cells in a range contain text in Excel, use =COUNTIF(range,"*") or, in newer versions, =COUNTA(range) minus any numbers. The asterisk wildcard in COUNTIF matches any text string of one or more characters, so =COUNTIF(A2:A100,"*") returns the number of cells in that range holding text and ignores blanks, numbers, and errors. COUNTA counts everything that is not empty, so it is only the right tool when the range holds text alone.
This guide covers the exact formulas, how to count text in a single column or across a whole sheet, how to count cells that contain specific text, and the traps that make the numbers look wrong. The steps apply to Excel for Microsoft 365, Excel 2021, 2019, and 2016 on Windows and Mac; menu labels can differ slightly by version and region, but the formulas are the same everywhere.
What You'll Need
- Excel 2016 or later (any edition, Windows or Mac) or Excel for the web.
- A worksheet with data, and a blank cell where the result will go.
- Basic familiarity with typing a formula and pressing Enter.
Step-by-Step
- Pick the result cell. Click an empty cell outside your data range, for example D2, so the count does not overwrite anything.
- Type the COUNTIF formula. Enter
=COUNTIF(A2:A100,"*")and press Enter. Replace A2:A100 with your actual range. The"*"is a wildcard meaning "any text," so only cells containing at least one character of text are counted. - Read the result. The cell now shows how many cells in the range contain text. Cells that are empty, hold only numbers, or hold dates are not counted by this formula.
- Count text in a whole column without guessing the last row. Use a full-column reference:
=COUNTIF(A:A,"*"). This counts every text cell in column A. Put the formula outside column A (for example in B1) so it does not count its own result. - Count text across several columns. Widen the range:
=COUNTIF(A2:C100,"*")counts text in columns A through C, rows 2 to 100. - Count cells containing specific text. To count cells that contain the word "apple" anywhere in the cell, use
=COUNTIF(A2:A100,"*apple*"). The wildcards on both sides mean "anything before and after." For an exact match of the whole cell, drop the wildcards:=COUNTIF(A2:A100,"apple"). - Make the search term a cell reference. Put the word in, say, E1 and use
=COUNTIF(A2:A100,"*"&E1&"*"). Change E1 and the count updates, which is handy for checking several terms. - Count text case-insensitively or case-sensitively. COUNTIF ignores case, so "Apple" and "apple" both match. If case matters, use
=SUMPRODUCT(--ISNUMBER(FIND("apple",A2:A100))), which is case-sensitive. - Count non-empty cells when the range is text only. If every entry is text and you just want non-blanks,
=COUNTA(A2:A100)is shorter. Remember it also counts numbers, dates, logical values, and error values, so use COUNTIF with the wildcard when the range is mixed. - Check the total. Compare the count with the visible rows. If the number is lower than expected, look for cells that hold numbers stored as text, leading apostrophes, or formulas returning empty strings (see Common Mistakes).
Common Mistakes
Using COUNTA on a mixed range. COUNTA counts numbers and dates too, so it overstates the text count. Use COUNTIF with "*" instead.
Expecting COUNTIF to count formula blanks. A formula that returns "" (an empty string) is still text to COUNTIF and will be counted. If your range contains such formulas, filter them out or use a helper column with =LEN(A2)>0 and count the TRUE values.
Forgetting the quotes around the wildcard. =COUNTIF(A2:A100,*) is invalid and Excel will reject it. The wildcard must be inside double quotes.
Counting the formula's own cell. If you put a full-column formula in column A, it counts itself. Keep the result cell outside the counted range.
Assuming COUNTIF is case-sensitive. It is not. Use FIND with SUMPRODUCT when case matters.
Mistaking numbers stored as text. A number typed with a leading apostrophe is text and will be counted. If the count seems too high, select the range and check the status bar or use =ISTEXT(A2) on a sample cell.
Tips
Name your range (Formulas > Define Name) so formulas read as =COUNTIF(SalesText,"*") and stay readable as the sheet grows.
Use a table (Insert > Table) and reference the column, for example , so the range expands automatically when you add rows.
To count text cells that are not duplicates of a specific value, combine COUNTIF with a cell reference: =COUNTIF(A2:A100,"*")-COUNTIF(A2:A100,"apple").
For a quick visual check, select the range and look at the status bar; it shows Count (non-empty) but not a text-only count, so treat it as a rough cross-check, not the answer.
If you need to count by colour or by formatting, COUNTIF cannot do it; use Filter by colour and read the row count, or a helper column with a formula.
Troubleshooting
The formula returns 0 but you can see text. Check the range reference first; a typo like A2:A10 instead of A2:A100 is the usual cause. Then confirm the cells are not numbers formatted to look like text. Click one and look at the formula bar: a leading apostrophe means text, a plain number means it is not counted.
The count is higher than the number of visible rows. Hidden rows are still counted. Filter the data and use =SUBTOTAL(103,A2:A100) for a visible-rows count, or clear the filter to compare.
The formula shows #VALUE! or a dialog about the formula. A missing quote or a comma where your region expects a semicolon is the likely culprit. Some regional settings use ; instead of , as the argument separator; Excel usually corrects this as you type, but pasted formulas can break.
Text with trailing spaces is not matching a specific word. "*apple*" still matches "apple ", but an exact match does not. Trim the data with =TRIM(A2) in a helper column, then count that column.
The count changes when you sort or edit. That is expected: the formula is live. If you need a fixed number, copy the result cell and use Paste Special > Values.
If that did not work, rebuild the formula in a fresh cell step by step: type =COUNTIF(, select the range with the mouse, type ,"*", close the bracket, and press Enter. Selecting the range directly avoids reference typos.
Frequently Asked Questions
What is the difference between COUNTIF with "*" and COUNTA?
COUNTIF with "*" counts only cells containing text. COUNTA counts every non-empty cell, including numbers, dates, logical values, and errors. Use COUNTIF for a true text count.
Does COUNTIF count cells with a space as text?
Yes. A cell containing a single space is text and matches "*". If stray spaces inflate your count, clean the data with TRIM or use a helper column with =LEN(TRIM(A2))>0.
How do I count text in a filtered list only?
COUNTIF counts hidden rows too. For visible rows only, use =SUBTOTAL(103,range), which counts non-empty visible cells, or add a helper column and combine SUBTOTAL with your text test.
Can I count cells that start with a specific letter?
Yes: =COUNTIF(A2:A100,"A*") counts cells beginning with A. The asterisk stands for any number of characters after it.
Why does COUNTIF count my formula cells that look empty?
A formula returning "" produces an empty string, which Excel treats as text. COUNTIF with "*" counts it. Replace the empty-string result with a truly blank cell, or count with a LEN-based helper column instead.
Does this work in Excel for the web and Google Sheets?
The COUNTIF wildcard syntax works in Excel for the web. Google Sheets also supports =COUNTIF(range,"*"), though wildcard behaviour can differ slightly, so verify the result against a small sample.