COUNTIF Is Blank? Use These Formulas

Formulas & functions · Updated November 22, 2026

The direct answer: there is no COUNTIF function that counts truly blank cells by itself, but you can use COUNTIF(range, "") to count cells that are empty, or COUNTIF(range, "<>") to count cells that are not empty. For cells that look blank but contain formulas returning empty text (“”), you need SUMPRODUCT or COUNTBLANK depending on what you want. This article explains the difference, shows you the exact formulas, and covers common pitfalls.

What “Blank” Really Means in Excel

In Excel, a cell can be truly empty (no value, no formula, no formatting) or appear blank because it contains a formula that returns an empty string (like =IF(A1="","",B1)), or contains a space character, or has a formula that returns "". The COUNTIF function treats these differently:

  • Truly empty cell: No characters at all. COUNTIF(range,"") counts it.
  • Formula returning “”: The cell has a formula, so it is not truly empty. COUNTIF(range,"") counts it as blank (because the result is an empty text string), but COUNTBLANK also counts it. However, COUNTIF(range,"<>") does NOT count it as non-blank – it treats it as blank.
  • Space character: A single space is a text character, so COUNTIF(range,"") does NOT count it, but COUNTIF(range," ") would. COUNTBLANK ignores spaces.

To avoid confusion, always ask yourself: do you want to count cells that are visually empty, or cells that contain no data at all?

Basic COUNTIF Formulas for Blank and Non-Blank

Assume your data is in A2:A20. Here are the standard formulas:

  • Count truly blank cells: =COUNTIF(A2:A20,"") – returns the number of cells that are empty or contain a formula returning an empty string.
  • Count non-blank cells: =COUNTIF(A2:A20,"<>") – returns the number of cells that are not empty. This includes cells with numbers, text, errors, and even formulas returning “” (because the formula itself is not blank).

Example: If A2:A5 contain 1, "" (formula), (space), and nothing, then:

  • =COUNTIF(A2:A5,"") returns 2 (the formula cell and the truly empty cell).
  • =COUNTIF(A2:A5,"<>") returns 3 (1, the formula cell, and the space – because space is not empty).

Note: COUNTIF with "<>” counts cells that contain any character, including a space. If you want to exclude spaces, use =SUMPRODUCT((A2:A5<>"")*(TRIM(A2:A5)<>"")).

When to Use COUNTBLANK Instead

Excel has a dedicated COUNTBLANK function: =COUNTBLANK(range). It counts cells that are truly empty OR contain a formula that returns an empty string. It does NOT count cells with spaces, zeros, or text. So for most purposes, COUNTBLANK is simpler than COUNTIF(range,""). The difference: COUNTIF(range,"") also counts cells with formulas that return "", but it does NOT count cells with a space. COUNTBLANK does count formula-blank cells, but it also counts cells with no content at all. In practice, both give the same result for most datasets.

Use COUNTBLANK when you want a straightforward count of empty-looking cells. Use COUNTIF when you need to combine the blank condition with other criteria, like counting blanks in a specific category.

Counting Blank Cells Based on Another Column

Often you want to count blank cells in column B only if column A says “Yes”. COUNTIF can’t do that directly, but COUNTIFS can. For example, with categories in A2:A20 and values in B2:B20:

  • Count rows where A is “Yes” and B is blank: =COUNTIFS(A2:A20,"Yes",B2:B20,"")
  • Count rows where A is “Yes” and B is not blank: =COUNTIFS(A2:A20,"Yes",B2:B20,"<>")

These work like the single-range versions, but require that both conditions be true. Note that COUNTIFS also treats formula-returning-“” as blank.

Common Problems and Misconceptions

Problem 1: Counting cells with spaces. If a cell contains a space (often from data entry), COUNTIF(range,"") will not count it. To count cells that are visually empty including spaces, use =SUMPRODUCT((TRIM(A2:A20)="")*(A2:A20<>"")) plus COUNTBLANK – but that gets complex. Simpler: use =COUNTBLANK(A2:A20)+COUNTIF(A2:A20," ") to add spaces.

Problem 2: Counting errors as non-blank. COUNTIF(range,"<>") counts cells with errors like #N/A because they are not empty. If you want to count cells that have any value except errors, you need =SUMPRODUCT((A2:A20<>"")*(ISERROR(A2:A20)=FALSE)).

Problem 3: Using "" in COUNTIF with wildcards. Some users try COUNTIF(range,"*") to count non-blank, but that counts only text cells, not numbers or errors. Stick with "<>” for non-blank.

Misconception: COUNTIF(range,”=”) counts blanks. That actually counts cells containing an equals sign, not blanks. Don’t use it.

Alternatives: SUMPRODUCT and Dynamic Arrays

For more control, use SUMPRODUCT. For example, to count truly empty cells that are also in a specific row range:

=SUMPRODUCT((A2:A20="")*1)

This counts cells that are truly empty (no formula). It ignores formula-returning-“”. To count cells that are empty or contain “” (like COUNTBLANK), use:

=SUMPRODUCT((A2:A20="")+(A2:A20=""))

But that’s redundant; just use COUNTBLANK.

If you have Excel 365, you can use FILTER to list the blank cells, but for counting, COUNTIF and COUNTBLANK are simplest.

Frequently Asked Questions

Q: Does COUNTIF count cells with formulas that return “”?
Yes, COUNTIF(range,"") counts cells whose result is an empty text string, even if they contain a formula. COUNTIF(range,"<>") does NOT count them as non-blank – it treats them as blank.

Q: How do I count truly empty cells (no formula)?
Use =SUMPRODUCT((A2:A20="")*1) or =COUNTIF(A2:A20,"") – both count cells with no content and no formula. But note that COUNTIF also counts formula-blank cells, so it’s not truly empty. To exclude formula-blank cells, use =SUMPRODUCT((A2:A20="")*(ISFORMULA(A2:A20)=FALSE)).

Q: Why does COUNTIF(range,”<>“) count a cell with a space?
Because a space is a text character. The cell is not empty; it has a space. To ignore spaces, use =SUMPRODUCT((TRIM(A2:A20)<>"")*(A2:A20<>"")).

Q: Can I count non-blank cells with COUNTIF?
Yes, use =COUNTIF(range,"<>"). It counts all cells that are not empty, including numbers, text, errors, and formulas returning values. It does not count cells with formulas returning “” because those are considered blank.

Q: Is COUNTBLANK better than COUNTIF for blanks?
For simple counts, yes – COUNTBLANK is clearer and does exactly what it says. Use COUNTIF when you need to combine blank with other criteria (via COUNTIFS) or when you want to count non-blank.

Q: How do I count blank cells in Google Sheets?
Google Sheets works the same way: =COUNTIF(A2:A20,"") and =COUNTBLANK(A2:A20) work identically. The difference: Google Sheets treats a cell with a formula returning “” as blank, same as Excel.

Final Tips for Accurate Counting

Always check your data for spaces and formula-returned empty strings. Use TRIM to clean data if needed. Test your formula on a small sample to verify the count matches your expectation. Remember that COUNTIF is case-insensitive and ignores wildcards when used with "" – but it’s the standard way to count blanks. For a quick visual check, use Excel’s Go To Special > Blanks (Home > Find & Select > Go To Special) to see which cells Excel considers blank.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.