Function Problems

Count Text Cells in Excel with COUNTIF or COUNTA

Elise WilliamsElise Williams Nov 25, 2026 873 views

Question details

Count cells containing text and understand how formula-generated empty strings affect the result.

Count Text Cells in Excel with COUNTIF or COUNTA
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants to count text cells in a range without unintentionally including cells whose formulas return an empty string.
Observed behavior
COUNTA counts cells containing formulas that return an empty string, which can make the total higher than expected.
Before you start

Identify the range you want to count and check whether any cells contain formulas that return "". Decide whether cells containing only spaces should be included.

Solution 1Recommended

Count Text Cells with at Least One Character

Use COUNTIF with a wildcard criterion to count text while excluding empty strings.

1
Select a result cell

Click an empty cell outside the range you want to count.

2
Enter the COUNTIF formula

Type =COUNTIF(A1:C1,"?*") and press Enter. Replace A1:C1 with your range.

3
Check the result

Compare the result with the text cells in the range. The criterion requires at least one character, so it excludes formulas returning "" but counts cells containing spaces.

Count Text Cells with at Least One Character
Why use ?* instead of *?: The * wildcard can match an empty string. Using ?* requires at least one character, which helps exclude formula-generated empty strings.
Count text in WPS Spreadsheets

Count Text Cells with COUNTIF in WPS Spreadsheets

Open your spreadsheet in WPS Spreadsheets and use COUNTIF with the ?* criterion to count text containing at least one character.

  1. 1. Open your spreadsheet: Open WPS Spreadsheets and select the workbook containing your data.
  2. 2. Select a result cell: Click an empty cell outside the range you want to count.
  3. 3. Enter the formula: Type =COUNTIF(A1:C1,"?*") and press Enter, replacing A1:C1 with your range.
  4. 4. Review the count: Check the result against your data; cells containing spaces are included.
Count text while excluding formula-generated empty stringsOpen and edit Microsoft Excel XLS and XLSX filesUse familiar spreadsheet formulas and controls
microsoft office alternative - wps office

Frequently Asked Questions

Why does COUNTA return one more cell than I expect?

A cell may contain a formula that returns "" or a space. Select the cells and check the formula bar; COUNTA includes both.

Does COUNTIF with "*" exclude formulas that return an empty string?

Not necessarily. The * wildcard can match an empty string. Use =COUNTIF(A1:C1,"?*") to require at least one character.

Will the COUNTIF formula count cells containing only spaces?

Yes. A space is a character, so =COUNTIF(A1:C1,"?*") includes cells containing only spaces.

Does COUNTA count numbers as well as text?

Yes. COUNTA counts cells containing numbers, text, errors, and formulas, including formulas that return an empty string.