Curious Minds

Clear answers to science and history questions

How to Count How Many Cells Have Text in Excel

· 4 min read · Numbers and Records

To count how many cells contain text in Excel, use the COUNTIF function with a wildcard or combine ISTEXT with SUMPRODUCT. These methods count cells that hold any textual value, ignoring numeric entries and blank cells.

What You’ll Need

  • Microsoft Excel (any recent version)
  • A worksheet with data you want to analyze
  • Basic familiarity with formulas and cell references

Step‑by‑Step

  1. Open your worksheet. Navigate to the sheet that contains the data range you wish to evaluate.
  2. Decide on the range. For example, if your data occupies cells A1 through A20, that will be the reference for the formula.
  3. Choose a counting method. Two common approaches are:
    • COUNTIF with a wildcard: =COUNTIF(A1:A20,"*"). This counts any cell that contains at least one character, including numbers stored as text.
    • SUMPRODUCT with ISTEXT: =SUMPRODUCT(--ISTEXT(A1:A20)). This counts only cells that Excel recognises as text, excluding numeric values and blanks.
  4. Enter the formula. Click an empty cell where you want the result to appear, type the chosen formula, and press Enter.
  5. Verify the result. The cell should display a number equal to the count of text‑containing cells. If it shows 0 or an error, proceed to troubleshooting.
  6. Use named ranges for clarity. If your data is in an Excel Table named MyTable, the formula becomes =COUNTIF(MyTable[Column],"*") or =SUMPRODUCT(--ISTEXT(MyTable[Column])).
  7. Apply the formula to multiple columns. To count text across two columns, use =SUMPRODUCT(--ISTEXT(A1:A20),--ISTEXT(B1:B20)) or combine COUNTIFs: =COUNTIF(A1:A20,"*")+COUNTIF(B1:B20,"*").
  8. Leverage dynamic arrays. In Excel 365, use =FILTER(A1:A20, ISTEXT(A1:A20)) to list all text entries, then wrap with COUNTA to count them: =COUNTA(FILTER(A1:A20, ISTEXT(A1:A20))).
  9. Consider trimming spaces. If cells may contain only spaces, add TRIM to the condition: =SUMPRODUCT(--ISTEXT(TRIM(A1:A20))) to exclude cells that appear blank but contain spaces.
  10. Save your workbook. After verifying the count, save the file to preserve the formula and results.

Common Mistakes

  • Using COUNTA alone, which counts numbers as well as text.
  • Applying COUNTIF with an empty string ("") instead of a wildcard, which counts only truly blank cells.
  • Referencing the wrong range or mixing relative and absolute references, causing the formula to count unintended cells.
  • Ignoring cells that contain spaces; these are counted as text unless trimmed.
  • Not accounting for hidden rows or filtered data; COUNTIF counts hidden cells unless SUBTOTAL is used.
  • Using ISTEXT without the double unary (--), which returns an array that Excel may not evaluate correctly.

Tips

  • Use SUBTOTAL(103, A1:A20) to count visible text cells only when a filter is applied.
  • Combine IFERROR with your formula to handle unexpected errors: =IFERROR(SUMPRODUCT(--ISTEXT(A1:A20)),0).
  • Highlight counted cells with conditional formatting: apply a rule that formats cells where ISTEXT(A1) is true.
  • When working with large datasets, convert the range to an Excel Table; formulas automatically adjust as rows are added.
  • Use the Find & Replace dialog to locate all cells containing a specific word, then manually count if needed.
  • For case‑sensitive counting, combine EXACT with SUMPRODUCT: =SUMPRODUCT(--EXACT(A1:A20,"desiredText")).

Troubleshooting

  • Formula returns 0 or an unexpected number. Check that the range includes the intended cells and that the formula syntax is correct. Ensure the range is not inadvertently locked or protected.
  • Formula shows #VALUE!. This often occurs if the range contains errors. Use IFERROR or AGGREGATE to bypass them.
  • Formula counts numbers as text. Use SUMPRODUCT(--ISTEXT(range)) to restrict counting to true text entries.
  • Hidden rows affect the count. Replace COUNTIF with SUBTOTAL(103, range) to count only visible cells.
  • If the formula still returns zero, double‑check that the cells are not formatted as Text but actually contain text. You can re‑enter the data or use the Text‑to‑Columns tool to convert them.

Frequently Asked Questions

Can I count cells that contain only spaces?

No, because those cells are considered blank. Use TRIM or LEN(TRIM(cell))>0 to exclude them.

Does COUNTIF ignore hidden rows?

No, COUNTIF counts all cells in the range, regardless of visibility. Use SUBTOTAL(103, range) for visible‑only counts.

How do I count text that includes numbers, like “ABC123”?

Both COUNTIF(range,"*") and SUMPRODUCT(--ISTEXT(range)) will count such cells because they contain text characters.

Can I use a VBA macro to count text cells?

Yes, a simple loop using If IsText(cell) Then count = count + 1 will do the job, but the built‑in formulas are usually faster.

What if I need a case‑sensitive count?

Use SUMPRODUCT(--EXACT(range,"text")) to count only cells that match the exact case.

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