Smart Systems for Home

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

Count Cells Containing Text in Excel & Google Sheets

· 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 cells containing text in Excel or Google Sheets, use the COUNTIF function with a wildcard: =COUNTIF(range,"*"). This counts every cell in the range that contains at least one character, including spaces, numbers, and punctuation. If you need to exclude cells with only numbers, use =COUNTIF(range,"*?") or a SUMPRODUCT formula. This guide walks you through the exact steps for both Excel and Google Sheets, covers common pitfalls, and answers frequent questions.

What You'll Need

  • A spreadsheet with a column or range of cells you want to check.
  • Excel (2010 or later) or Google Sheets (any current version).
  • Basic familiarity with typing formulas into a cell.

Step-by-Step

Method 1: Count All Cells with Any Text (Including Numbers)

  1. Open your spreadsheet in Excel or Google Sheets.
  2. Click an empty cell where you want the count to appear.
  3. Type =COUNTIF(A1:A10,"*") – replace A1:A10 with your actual range. The asterisk (*) is a wildcard that matches any sequence of characters, so it counts cells that are not empty.
  4. Press Enter. The result shows how many cells in the range have any content, including numbers, dates, and even spaces.

Method 2: Count Only Cells with Text (Excluding Numbers and Dates)

  1. Use the same range as above.
  2. Type =COUNTIF(A1:A10,"*?") – the question mark (?) matches a single character, so this counts cells that have at least one character before the asterisk. This excludes purely numeric cells because numbers are not text.
  3. Press Enter. This counts cells that contain letters, words, or a mix of text and numbers (like "Order 123").

Method 3: Use SUMPRODUCT for More Control (Excel & Google Sheets)

  1. Type =SUMPRODUCT(--ISTEXT(A1:A10)) – this counts cells that are text, ignoring numbers, dates, and blanks.
  2. For a range that might contain errors, use =SUMPRODUCT(--(ISTEXT(A1:A10)*(A1:A10<>""))) to exclude empty cells.
  3. Press Enter. This method is more precise because ISTEXT returns TRUE only for text values.

Method 4: Count Cells with Specific Text (Partial Match)

  1. To count cells that contain a certain word (e.g., "apple"), use =COUNTIF(A1:A10,"*apple*") – the asterisks allow the word to appear anywhere in the cell.
  2. For case-sensitive matching in Excel, use =SUMPRODUCT(--ISNUMBER(SEARCH("apple",A1:A10))) – SEARCH is case-insensitive. For case-sensitive, use FIND instead of SEARCH.
  3. In Google Sheets, the same formulas work; FIND is case-sensitive, SEARCH is not.

Method 5: Count Cells That Are Not Empty (Any Content)

  1. Use =COUNTA(A1:A10) – this counts all non-empty cells, including numbers, text, dates, and errors. It does not count cells with formulas that return empty strings ("").
  2. If you want to count cells that have any content but exclude blank cells, COUNTA is the simplest.

Common Mistakes

  • Using COUNTIF(range,"*") and expecting it to ignore numbers – it counts numbers too. Use "*?" or ISTEXT to exclude numbers.
  • Forgetting that spaces count as text – a cell with a single space will be counted. Use =COUNTIF(range,"?*") (which requires at least one character before the asterisk) to avoid counting spaces, but note that this still counts spaces if they are at the start.
  • Using COUNTIF with a range that includes entire columns (e.g., A:A) – this can slow down your sheet and may count unintended cells. Use a specific range.
  • Mixing up COUNTIF and COUNTA – COUNTIF with a wildcard counts text, but COUNTA counts all non-empty cells. Choose based on your need.
  • Not locking the range when copying the formula – if you copy the formula down, the range will shift. Use absolute references like $A$1:$A$10 if needed.

Tips

  • To count cells that contain text but exclude cells with only spaces, use =COUNTIF(range,"?*") – the question mark requires at least one character, and the asterisk allows any length. This still counts cells with spaces if the space is not the first character.
  • For a more robust text-only count, use =SUMPRODUCT(--(TRIM(A1:A10)<>"")) – this trims spaces and counts non-blank cells.
  • In Google Sheets, you can also use =COUNTIF(A1:A10,"*",A1:A10,"<> ") but it's simpler to use =COUNTIF(A1:A10,"?*").
  • If you want to count cells that contain text but not numbers, use =COUNTIF(range,"*[A-Za-z]*") in Excel – but this only works with letters, not other text characters. Better to use ISTEXT.
  • For a quick visual count, use the Find feature (Ctrl+F) and type * in the Find what box, then click Find All – the status bar shows the count, but this includes numbers.

Troubleshooting

If the formula returns 0 but you see text cells:

  • Check for leading or trailing spaces – use =TRIM(A1) to see if that helps.
  • Make sure the range is correct – click the cell and verify the formula references the right cells.
  • If you used "*?", remember it counts cells with at least one character, but if your text is only a space, it won't count. Use "*" instead.

If the formula counts cells with numbers:

  • Use =SUMPRODUCT(--ISTEXT(range)) to count only text values.
  • Alternatively, use =COUNTIF(range,"*[A-Za-z]*") in Excel, but this only catches letters.

If the formula returns an error like #VALUE!:

  • Check for mismatched parentheses or commas – ensure you have the correct syntax.
  • In Google Sheets, use semicolons instead of commas if your locale uses them (e.g., =COUNTIF(A1:A10;"*")).

If the count seems too high:

  • You might be counting cells with formulas that return empty strings – use =SUMPRODUCT(--(LEN(range)>0)) to count only cells with actual characters.

Frequently Asked Questions

Does COUNTIF count cells with numbers?

Yes, =COUNTIF(range,"*") counts any non-empty cell, including numbers. To exclude numbers, use =COUNTIF(range,"*?") or ISTEXT.

How do I count cells that contain a specific word?

Use =COUNTIF(range,"*word*") – the asterisks allow the word to appear anywhere. For case-sensitive, use =SUMPRODUCT(--ISNUMBER(FIND("word",range))) in Excel or Google Sheets.

Can I count cells with text in multiple columns?

Yes, use a range like A1:B10 in COUNTIF – it counts cells in the entire range. For text-only, use =SUMPRODUCT(--ISTEXT(A1:B10)).

Why does my COUNTIF formula count cells with spaces?

Because a space is a character. Use =COUNTIF(range,"?*") to require at least one non-space character, but this still counts cells with spaces if they are not the first character. For a true text count, use ISTEXT.

What is the difference between COUNTA and COUNTIF?

COUNTA counts all non-empty cells, including numbers and errors. COUNTIF with a wildcard counts cells that match a text pattern. For text only, use COUNTIF with "*?" or ISTEXT.

How do I count cells with text but exclude blank cells in Google Sheets?

Use =COUNTIF(A1:A10,"?*") – this counts cells with at least one character. For a more precise text count, use =SUMPRODUCT(--ISTEXT(A1:A10)).