How to count cells with text in Excel
Updated · Checked on a live sheet · Excel and Google Sheets
The formula
To count cells with text in Excel, use =COUNTIF(range, "*"): for example =COUNTIF(E2:E7, "*") counts the cells in E2:E7 that contain text. The asterisk is a wildcard for “any characters”, which only text matches, so numbers and empty cells aren't counted. Microsoft's COUNTIF page uses the same example.
In general: =COUNTIF(range, "*")
Try it on a live sheet
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Campaign | Clicks | Sales | Conversion | Owner | With an owner | 4 | |
| 2 | Spring email | 1200 | 36 | Mara | ||||
| 3 | 860 | 12 | ||||||
| 4 | Display ads | 0 | 0 | Jonas | ||||
| 5 | Search ads | 2300 | 69 | Priya | ||||
| 6 | Newsletter | 540 | 27 | |||||
| 7 | Partner blog | 0 | 0 | Kenji |
H1 shows 4: Mara, Jonas, Priya and Kenji. The two campaigns without an owner are skipped.
Why it works
Counts the cells in E2:E7 whose value matches the pattern "*" (* stands for any text, ? for one character).
- 1. COUNTIF: Counts the cells in
E2:E7whose value matches the pattern"*"(*stands for any text,?for one character).
Every non-empty cell: COUNTA
COUNTA(E2:E7) counts every cell that isn't empty, text and numbers alike. Use it when you want “filled in”, and COUNTIF with "*" when you want text only.
=COUNTA(E2:E7)Text containing a word
Put the word between asterisks: COUNTIF(A2:A7, "*ads*") counts the campaigns with “ads” anywhere in the name.
=COUNTIF(A2:A7,"*ads*")Numbers stored as text
To find how many entries in a number column are really text (and will be skipped by SUM), count the text cells in that column: COUNTIF(C2:C11, "*"). Anything above 0 is worth a look before you total the column.
=COUNTIF(C2:C11,"*")When you need it
Counting text cells helps you audit data: how many rows have a comment, how many records have an owner, how many “numbers” in a column are actually text and will be skipped by SUM. That last use catches imports that look right but don't add up. Compare COUNTIF with "*" against COUNTA and COUNT on the same range: if COUNT plus the text count doesn't equal COUNTA, something unexpected is in there.
In Google Sheets
Google Sheets' COUNTIF supports the same * and ? wildcards, so these formulas work there unchanged.
Common mistakes
Using COUNT, which counts only numbers, to count names.
Cells that look empty but hold a space or an empty string from a formula: COUNTIF with "*" may count them.
Expecting
"*"to count numbers stored as text as numbers: they're text, so they're counted.
Sources
Official documentation the facts on this page were checked against.