Count cells that contain text

=COUNTIF(rng,"*")
To count the number of cells that contain text (i.e. not numbers, not errors, not blank), use the COUNTIF function and a wildcard. In the generic form of the formula (above), rng is a range of cells, and "*" is a wildcard matching any number of characters.
In the example, the active cell contains this formula:
=COUNTIF(B4:B8,"*")
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.
COUNTIFS solution
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:
=COUNTIFS(range,"*",range,"<> ")
SUMPRODUCT solution
You can also use SUMPRODUCT to count text values along with the function ISTEXT like so:
=SUMPRODUCT(--ISTEXT(rng))
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.
Download 200+ Excel Shortcuts
Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.