Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Counting Number of Cells with Text: Best Methods

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To count the number of cells containing text in Excel, the fastest method is using the formula =COUNTIF(range, "*"). This specific formula uses a wildcard character (the asterisk) to identify any cell that contains one or more text characters while ignoring cells that contain only numbers, logical values, or are completely empty. This is essential for cleaning data sets, auditing form entries, or summarizing survey responses where you need to distinguish between a numeric value and a written comment.

What You'll Need

  • A computer with Microsoft Excel installed (works across Windows, macOS, and web versions).
  • A dataset containing a mix of text, numbers, and empty cells to test the formulas.
  • Basic knowledge of how to select a range of cells.

Step-by-Step

  1. Identify your data range: Locate the column or block of cells you want to analyze. For example, if your data is in column A from row 1 to 100, your range is A1:A100.
  2. Select the output cell: Click on the empty cell where you want the final count to appear.
  3. Enter the COUNTIF formula: Type =COUNTIF(A1:A100, "*") into the formula bar. Replace A1:A100 with your actual range. The "*" tells Excel to count any cell that contains any sequence of characters.
  4. Press Enter: The cell will now display the total number of cells that contain text.
  5. Alternative for mixed content (COUNTIFS): If you need to count cells that contain text but meet another specific condition (e.g., text in column A and a value over 10 in column B), use =COUNTIFS(A1:A100, "*", B1:B100, ">10").
  6. Handling formulas that return empty strings: If your cells contain formulas like =IF(B1="", "", "Active"), the COUNTIF wildcard might count the "" as text. To avoid this, use the SUMPRODUCT method: =SUMPRODUCT(--(ISTEXT(A1:A100))).
  7. Verify the results: Highlight the range manually and look at the status bar at the bottom of the Excel window. While the status bar usually shows "Count" (which includes numbers), comparing it to your text-only count helps ensure the formula is working correctly.

Common Mistakes

One of the most frequent errors is forgetting the quotation marks around the asterisk in the COUNTIF function. If you type =COUNTIF(A1:A100, *), Excel will return a formula error because it interprets the asterisk as an invalid mathematical operator rather than a wildcard string. Always ensure the wildcard is enclosed in double quotes.

Another common mistake is confusing COUNTA with a text-only count. Many users assume =COUNTA(A1:A100) counts text, but COUNTA actually counts any cell that is not empty. This means it counts numbers, dates, errors, and text. If your list contains both names (text) and ID numbers (numbers), COUNTA will give you the total of both, leading to an inflated result if you only wanted the text entries.

Users often overlook the impact of hidden characters. If a cell looks empty but contains a single space (hit by a user by accident), the "*" wildcard will count it as text. This can lead to discrepancies between what you see visually and what the formula reports.

Tips

To make your spreadsheets more dynamic, instead of typing the range A1:A100 directly into the formula, use a Named Range. Select your data, go to the Name Box (top left), and type "DataList". Your formula then becomes =COUNTIF(DataList, "*"). This makes the formula much easier to read and maintain if you move the data to a different sheet.

If you are dealing with a massive dataset and the formulas are slowing down your workbook, consider converting your data range into an Official Excel Table (Ctrl+T). Tables use structured references, meaning if you add new rows to the bottom of the table, the COUNTIF formula will automatically update to include the new data without you having to manually change the range from A100 to A101.

For those who need to count cells that contain specific text (e.g., cells containing the word "Completed"), you can combine the wildcard with a word: =COUNTIF(A1:A100, "*Completed*"). This will count every cell that has the word "Completed" anywhere inside it, regardless of what other text is in the cell.

Troubleshooting

The formula returns 0, but I can see text: Check if your "text" is actually formatted as numbers. For instance, if a cell contains a number but is formatted as "Text" in the Home tab, Excel may treat it differently. Ensure there are no leading apostrophes that might be confusing the range. Also, check if you have accidentally used a semicolon instead of a comma as a separator; this depends on your regional settings (some European versions of Excel use ;).

The count is higher than the number of visible text cells: This usually happens because of "invisible" text. This includes cells containing only spaces or non-printing characters imported from a web database. To fix this, you can use the TRIM function in a helper column to remove extra spaces, or use the =SUMPRODUCT(--(LEN(TRIM(A1:A100))>0)*ISTEXT(A1:A100)) formula to ignore cells that only contain whitespace.

The formula returns a #VALUE! error: This typically occurs if the range you selected is invalid or if the formula is referencing a cell that contains an error (like #REF! or #DIV/0!). Use the IFERROR wrapper, such as =IFERROR(COUNTIF(A1:A100, "*"), 0), to handle these cases gracefully.

Frequently Asked Questions

Does COUNTIF count cells with formulas that result in a blank?

Yes, the "*" wildcard often counts cells that contain a formula returning an empty string ("") because the cell is technically not empty. To avoid this, use SUMPRODUCT combined with ISTEXT.

Can I count cells that contain only numbers using a similar method?

Yes, the simplest way to count only numbers is to use the =COUNT(range) function. Unlike COUNTA, the standard COUNT function ignores text and only tallies numeric values.

How do I count cells that are completely empty?

Use the =COUNTBLANK(range) function. This will count every cell that is empty or contains a formula that returns an empty string.

Will the asterisk wildcard count cells that contain only a number?

No. The "*" wildcard specifically looks for text strings. If a cell contains only a number (e.g., 123), COUNTIF(range, "*") will ignore it.

Is there a way to count text without using formulas?

Yes, you can use the Filter feature. Click the filter dropdown on your column, uncheck "Numbers" or "Blanks," and then highlight the remaining visible cells. The count will appear in the bottom right status bar of the Excel window.