Count Cells That Contain Text
To count cells that contain text, use COUNTIF with a wildcard: an asterisk matches any text, and a word between two asterisks matches cells that contain that word anywhere. Describe what you want to count below and get the formula.
Free, no sign-up required · 5 free generations a day
Last updated
Describe your task, get the formula
Type what you need in plain English, or pick an example below. You get the formula, a step-by-step explanation, and a worked example.
Formulas for counting text cells
=COUNTIF(A2:A100,"*")
=COUNTIF(A2:A100,"*apple*")
=SUMPRODUCT(--ISTEXT(A2:A100))The asterisk stands for any number of characters, so a lone asterisk matches every text cell and skips numbers, dates and true blanks. SUMPRODUCT with ISTEXT counts the same thing without wildcards.
Examples
Count cells that contain a word
=COUNTIF(A2:A100,"*urgent*")Counts every cell where urgent appears anywhere in the text. COUNTIF is not case-sensitive, so Urgent and URGENT are included.
Use the search word from a cell
=COUNTIF(A2:A100,"*"&D2&"*")Joins the asterisks to the value typed in D2, so changing D2 changes what is counted without editing the formula.
Text in one column and a condition in another
=COUNTIFS(A2:A100,"*refund*",B2:B100,"Open")COUNTIFS counts only the rows where both conditions are true: column A contains refund and column B equals Open.
Common mistakes and how to fix them
Cells that look empty are counted
They contain an empty string from a formula or a space. To count only visible text use =SUMPRODUCT(--(LEN(TRIM(A2:A100))>0),--ISTEXT(A2:A100)).
Numbers are not counted by the wildcard
Wildcards only match text. To count numbers that contain certain digits, convert them first: =SUMPRODUCT(--ISNUMBER(SEARCH("12",A2:A100&""))).
The text itself contains an asterisk or question mark
Put a tilde before the character so it is taken literally, for example "*~?*" counts cells that contain a question mark.
Frequently asked questions
How do I count cells that do not contain a word?
Use the not-equal operator with the wildcard: =COUNTIF(A2:A100,"<>*urgent*"). Note that this also counts blank cells in the range.
How do I make the count case-sensitive?
COUNTIF ignores case. Use FIND, which does not: =SUMPRODUCT(--ISNUMBER(FIND("Urgent",A2:A100))).
How do I count cells that are not blank?
Use =COUNTA(A2:A100), which counts text, numbers, dates and errors — everything except truly empty cells.
Don't want to write it by hand?
Describe what you need in plain English and get a ready-to-use formula in seconds.
Try the formula generator