Countif Empty Cells: Excel Formula & Guide

Formulas & functions · Updated November 23, 2026

To count empty cells in Excel, use the COUNTBLANK function: =COUNTBLANK(range). For example, =COUNTBLANK(A1:A10) returns the number of truly empty cells in that range. If you need to count cells that look empty but contain formulas returning “” (empty text), use =COUNTIF(range,"") instead.

Why COUNTIF Can’t Directly Count Blanks

Many users try =COUNTIF(A1:A10,"") and get unexpected results. The reason: COUNTIF with a criterion of "" counts cells that contain empty text strings (formulas like =IF(1=2,"","x") that return “”), but it does not count truly blank cells. Excel treats a blank cell as having no value, while "" is a text value of zero length. This subtle distinction causes confusion.

If you want to count both truly empty cells and cells with empty text, use =COUNTBLANK(range) because it counts both. But if you only want cells with empty text (not truly blank), use =COUNTIF(range,""). For most counting tasks, COUNTBLANK is the right tool.

Using COUNTBLANK: Syntax and Examples

The COUNTBLANK function is simple: =COUNTBLANK(range). It counts cells that are empty or contain formulas that return empty text. It works on any range, including non-contiguous ranges if you use multiple arguments (e.g., =COUNTBLANK(A1:A5,C1:C5)).

Example: Suppose you have a list of order dates in B2:B20, and some cells are blank because orders haven’t shipped. To count how many orders are missing a ship date, use =COUNTBLANK(B2:B20). If 5 cells are blank, the formula returns 5.

Note: COUNTBLANK counts cells that contain an empty string from a formula, but it does not count cells with spaces, apostrophes, or other invisible characters. Those are not blank.

When to Use COUNTIF with “” Instead

You might need =COUNTIF(range,"") when you specifically want to count cells that have a formula returning an empty string, but you do not want to count truly blank cells. For instance, if you have a column where some cells contain formulas like =IF(A2="","",A2*2), and you want to count how many of those formulas produced an empty result, use COUNTIF with "". This is rare but useful.

Another scenario: You want to count cells that are either blank or contain empty text, but you want to exclude cells with spaces. COUNTBLANK already does that, so COUNTIF is only needed for the specific case above.

Counting Non-Empty Cells (Opposite)

To count cells that are not empty, use =COUNTA(range). COUNTA counts cells that contain any value, including numbers, text, errors, and formulas that return results. It does not count blank cells or cells with empty text. For example, =COUNTA(A1:A10) returns the number of non-empty cells.

If you need to count cells that are not empty but also exclude cells with empty text, use =SUMPRODUCT((range<>"")*1) or =COUNTIF(range,"<>"&""). The latter counts cells that are not equal to empty text, which includes truly blank cells? Actually, =COUNTIF(range,"<>"&"") counts cells that are not equal to empty text, but blank cells are considered equal to empty text in COUNTIF? Let’s clarify: In COUNTIF, a blank cell is treated as 0 if compared to a number, but when compared to text, blank cells are not counted as equal to “”. So =COUNTIF(range,"<>"&"") counts all cells that are not empty text, including truly blank cells? No, it counts cells that are not equal to empty text, and blank cells are not equal to empty text? Actually, testing shows that COUNTIF treats blank cells as equal to empty text for the criterion “”. So =COUNTIF(range,"<>") counts cells that are not blank, but =COUNTIF(range,"<>"&"") might be inconsistent. The safer way to count non-empty cells (including those with empty text) is =SUMPRODUCT((range<>"")*1).

For most users, COUNTA is sufficient.

Common Problems and Misconceptions

  • Spaces and invisible characters: A cell with a space (” “) is not blank. COUNTBLANK will not count it. To count cells that are truly empty or contain only spaces, use =SUMPRODUCT((TRIM(range)="")*1).
  • Formulas returning “”: As mentioned, COUNTIF with “” counts these, but COUNTBLANK also counts them, which often surprises users.
  • Merged cells: COUNTBLANK only counts the top-left cell of a merged range as blank if it’s empty; the other cells are ignored because they are not part of the range? Actually, merged cells only have a value in the top-left cell; the rest are considered empty but are not counted because they are not in the range? They are in the range if you select them, but they are not counted because they are not truly blank? In practice, COUNTBLANK counts them as blank if they are not the top-left cell? Testing shows that COUNTBLANK counts all cells in a merged range as blank if the top-left is blank? It’s messy; best to avoid counting merged cells.
  • Whole column references: =COUNTBLANK(A:A) counts all blank cells in column A, but it also counts cells beyond your data, which may return a huge number. Use a specific range like A1:A1000.

Counting Blank Cells with Criteria (e.g., in a Filtered List)

Sometimes you want to count blanks only for rows that meet another condition, like blanks in column B only when column A has “Yes”. Use COUNTIFS with a criterion for blanks: =COUNTIFS(A2:A20,"Yes",B2:B20,""). This counts rows where A is “Yes” and B is truly blank. Note: COUNTIFS with "" counts truly blank cells, not cells with empty text. If you need to count empty text as well, use SUMPRODUCT or add a helper column.

For example, with data in A2:A20 and B2:B20, =COUNTIFS(A2:A20,"Yes",B2:B20,"") returns the number of rows where A is “Yes” and B is blank. If you also want to include cells with empty text, use =SUMPRODUCT((A2:A20="Yes")*(B2:B20="")).

Alternatives: SUMPRODUCT and Dynamic Arrays

For more complex scenarios, SUMPRODUCT is flexible: =SUMPRODUCT(--(ISBLANK(A2:A20))) counts truly blank cells, but it does not count empty text. To count both, use =SUMPRODUCT(--(A2:A20="")) which counts both blank and empty text? Actually, A2:A20="" returns TRUE for blank cells and for cells with empty text, so it counts both. That’s a good alternative to COUNTBLANK.

In Excel 365, you can use =ROWS(FILTER(A2:A20,A2:A20="")) but that returns an array; better to use =COUNT(FILTER(A2:A20,A2:A20=""))? Actually, FILTER returns an array of blank cells? Blank cells are not returned by FILTER because they are considered zero? It’s messy. Stick with COUNTBLANK or SUMPRODUCT.

Frequently Asked Questions

Why does COUNTIF(A1:A10,””) return 0 even though there are blank cells?

Because COUNTIF with "" counts cells that contain an empty string returned by a formula, not truly blank cells. Truly blank cells are ignored by COUNTIF when the criterion is "". Use COUNTBLANK instead.

How do I count cells that are not blank in Excel?

Use =COUNTA(range) to count all non-empty cells, including those with formulas that return a value. If you want to exclude cells with empty text, use =SUMPRODUCT((range<>"")*1).

Can I count blank cells in a specific column based on a condition in another column?

Yes, use COUNTIFS with a blank criterion: =COUNTIFS(A2:A20,"Yes",B2:B20,""). This counts rows where A is “Yes” and B is blank. For empty text, use SUMPRODUCT.

Does COUNTBLANK count cells with formulas that return “”?

Yes, COUNTBLANK counts cells that contain a formula returning an empty string. This is often unexpected but documented behavior. If you want to count only truly blank cells, use =SUMPRODUCT(--(ISBLANK(range))).

How do I count blank cells in a filtered list?

Use SUBTOTAL with function number 109 (COUNTA) or 103 (COUNTA) for visible cells? Actually, to count visible blank cells, you can use =SUMPRODUCT(SUBTOTAL(3,OFFSET(A2,ROW(A2:A20)-ROW(A2),0)),--(A2:A20="")) but it’s complex. Simpler: add a helper column with =IF(A2="",1,0) and then use SUBTOTAL on that column.

What’s the difference between COUNTBLANK and COUNTIF with “”?

COUNTBLANK counts truly blank cells and cells with empty text. COUNTIF with "" counts only cells with empty text, not truly blank cells. Use COUNTBLANK for most purposes.

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.