Smart Systems for Home

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

Google Sheets: Count Cells With Text (Easy Steps)

· 6 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

Yes, you can count cells containing text in Google Sheets using the COUNTA function for a quick total, or the COUNTIF function for more control. The simplest formula is =COUNTA(A1:A100), which counts every non-empty cell in that range, including numbers and errors. If you need to count only cells that contain text (and exclude numbers and blanks), use =COUNTIF(A1:A100, "*text*") or the more precise =SUMPRODUCT(ISTEXT(A1:A100)*1). This guide walks through each method, explains the differences, and covers common mistakes.

What You'll Need

  • A Google Sheets document with data in one or more columns.
  • Basic familiarity with entering formulas into a cell (click a cell, type an equals sign, press Enter).
  • No special add-ons or extensions are required; these functions are built-in.

Step-by-Step

Method 1: Count All Non-Empty Cells with COUNTA

  1. Open your Google Sheets document.
  2. Click on an empty cell where you want the count to appear (e.g., B1).
  3. Type =COUNTA( (without the quotes).
  4. Select the range you want to count. For example, click and drag from A1 to A100, or type A1:A100 manually.
  5. Close the parenthesis and press Enter. The cell will display the number of non-empty cells in that range.
  6. Note that COUNTA counts numbers, dates, and error values as well as text. If your column contains any numbers, this total will include them.

Method 2: Count Only Cells with Text Using COUNTIF

  1. Click an empty cell for the result (e.g., B2).
  2. Type =COUNTIF(.
  3. Select the same range (e.g., A1:A100).
  4. Type a comma, then a wildcard pattern: "*" (asterisk inside quotes). The full formula looks like: =COUNTIF(A1:A100, "*").
  5. Press Enter. This counts every cell that contains at least one character of text. It will not count cells with only numbers, dates, or truly blank cells.
  6. To count cells that contain a specific word or phrase, replace the asterisk with that text, e.g., =COUNTIF(A1:A100, "apple") counts cells that exactly equal "apple". For partial matches, use "*apple*".

Method 3: Count Text Cells Excluding Numbers with SUMPRODUCT and ISTEXT

  1. Click an empty cell (e.g., B3).
  2. Type =SUMPRODUCT(ISTEXT(A1:A100)*1).
  3. Press Enter. This formula checks each cell in the range; ISTEXT returns TRUE for text cells and FALSE for non-text. Multiplying by 1 converts TRUE to 1 and FALSE to 0, and SUMPRODUCT adds them all up.
  4. This method is more precise than COUNTIF with "*" because it excludes cells that contain only numbers, even if they are formatted as text (e.g., a cell with '123 typed with a leading apostrophe).

Method 4: Count Cells That Are Not Blank (Excluding Empty Strings)

  1. If your data contains formulas that return empty strings (""), COUNTA will count them as non-empty, which may be undesirable.
  2. Use =COUNTIF(A1:A100, "?*") to count cells that have at least one character. This excludes truly empty cells and cells with only a zero-length string.
  3. Alternatively, use =SUMPRODUCT((A1:A100<>"")*1) to count all non-empty cells, including those with empty strings, but this is rarely what you want.

Counting with Criteria: Multiple Conditions

  1. To count cells that contain text and meet another condition (e.g., text in column A and a value in column B), use =COUNTIFS(A1:A100, "*", B1:B100, "Yes").
  2. COUNTIFS works the same as COUNTIF but accepts multiple range/criteria pairs. Each pair must be satisfied for a cell to be counted.

Common Mistakes

  • Using COUNTA when you only want text: COUNTA includes numbers, dates, and errors. If your column has numeric entries, the count will be too high.
  • Forgetting the asterisk quotes: =COUNTIF(A1:A100, *) without quotes will cause a parse error. Always use "*".
  • Counting blank cells that look empty: A cell containing a space character (" ") is not blank. COUNTA will count it. Use =COUNTIF(A1:A100, "?*") to exclude single spaces.
  • Applying the range incorrectly: Ensure the range matches your data exactly. If you include header row cells, they will be counted as text.
  • Using COUNTIF with wildcard on numbers: COUNTIF with "*" will not count numeric cells, but it will count cells formatted as text that contain numbers. If you have mixed data, verify with ISTEXT.

Tips

  • Use absolute references for fixed ranges: If you plan to copy the formula to other cells, use $A$1:$A$100 to prevent the range from shifting.
  • Combine with IFERROR for clean results: Wrap your formula in =IFERROR(COUNTIF(...), 0) to avoid showing errors if the range is empty or invalid.
  • Check for hidden characters: Imported data often contains non-breaking spaces or line breaks. Use =TRIM(A1) in a helper column to clean data before counting.
  • Use COUNTIF for case-insensitive matching: COUNTIF is not case-sensitive by default. "Apple" and "apple" are treated the same.
  • Count based on cell color: Google Sheets does not have a built-in function to count by background color. You would need a script or an add-on for that.

Troubleshooting

If your formula returns a #NAME? error: You likely misspelled a function name (e.g., "COUNTA" as "COUNT A") or used a comma instead of a semicolon in some locales. Check the function spelling and ensure you use the correct list separator for your region (often comma in the US, semicolon in Europe).

If the count is zero but you see text: The text might be a formula result that returns an empty string, or the cells might contain numbers formatted as text. Use =ISTEXT(A1) on a single cell to verify. If it returns FALSE, the cell is not considered text.

If the count is too high: You are probably counting blank cells or cells with spaces. Try =COUNTIF(A1:A100, "?*") to count only cells with at least one visible character.

If the formula works but updates slowly: Large ranges (e.g., A1:A100000) can slow down calculations. Limit the range to your actual data area, or use a dynamic range like A1:A (in newer Sheets versions) which automatically expands.

If you need to count cells with text across multiple sheets: Use a formula like =COUNTA(Sheet1!A1:A100) + COUNTA(Sheet2!A1:A100) or reference multiple sheets in a single COUNTIF if your Sheets version supports it.

Frequently Asked Questions

Does COUNTA count cells with spaces?

Yes, COUNTA counts any cell that is not truly empty. A cell with a single space character is considered non-empty. Use =COUNTIF(A1:A100, "?*") to exclude cells with only spaces.

Can I count cells that contain specific text like "urgent"?

Yes, use =COUNTIF(A1:A100, "*urgent*") to count cells that contain "urgent" anywhere in the text. The asterisks are wildcards that match any characters before or after.

How do I count cells that are not blank and not numbers?

Use =SUMPRODUCT(ISTEXT(A1:A100)*1) which counts only cells where the content is text, excluding numbers, dates, and errors.

What is the difference between COUNTA and COUNTIF?

COUNTA counts all non-empty cells regardless of content type. COUNTIF counts cells that meet a specific condition, such as containing text, a number, or a particular value. For counting text, COUNTIF with "*" is more targeted.

Can I count text cells in a row instead of a column?

Yes, just change the range to a row, e.g., =COUNTIF(A1:Z1, "*") will count text cells in row 1 from column A to Z.

Why does my COUNTIF formula return 0 for cells that look like text?

This often happens when the cells contain numbers formatted as text (e.g., from a CSV import). The cell displays as text but stores a number. Use =SUMPRODUCT(ISTEXT(A1:A100)*1) to see the true text count, or convert the cells to text format using the "Format > Number > Plain text" option.