Count cells that contain text in Excel
This tutorial shows how to Count cells that contain text in Excel using the example below;
To count the number of cells that contain text (i.e. not numbers, not errors, not blank), use the COUNTIF function and a wildcard.
“*” is a wildcard matching any number of characters.
In the example, the active cell contains this formula:
How this formula works
COUNTIF counts the number of cells that match the supplied criteria. In this case, the criteria is supplied as the wildcard character “*” which matches any number of text characters.
A few notes:
- The logical values TRUE and FALSE are not counted as text
- Numbers are not counted by “*” unless they are entered as text
- A blank cell that begins with an apostrophe (‘) will be counted.
If you need to restrict counts to meet more specific criteria, you can switch to the COUNTIFs function. For example, to count cells with text, but exclude cells with only a space character, you could use:
You can also use SUMPRODUCT to count text values along with the function ISTEXT like so:
The double hyphen (called a double unary) coerces the result of ISTEXT from a logical value of TRUE or FALSE, to 1’s and 0’s. SUMPRODUCT then returns the sum of ones and zeros.