The simplest way to count empty cells is =COUNTBLANK(A1:A10), which is built for exactly this job. With COUNTIF, use an empty pair of quotes as the criteria: =COUNTIF(A1:A10,""). The two differ on one point that matters — COUNTBLANK counts a formula returning “” as blank, while COUNTIF does not, so on a sheet full of formulas the two can disagree.
Neither counts a cell holding a space, which looks empty but isn’t. To include those, use =SUMPRODUCT(--(LEN(TRIM(A1:A10))=0)), which strips spaces before testing, so it catches genuinely empty cells and space-only cells alike.
To count blanks against a condition, use COUNTIFS: =COUNTIFS(A1:A10,"North",B1:B10,"") counts the rows where the zone is North and the score is missing. And to find where the blanks are rather than count them, press F5 → Special → Blanks to select them all at once.
Let’s say you have students’ data with their scores. However, some students were missing on exam day, and their scores are not on the list, but their names are. So the best way to count the students who were absent is to count the blank cells in column B.

And, if you want to count cells that are blank in Excel, you can use COUNTIF and COUNTBLANK, which can count cells that are empty (without any value in them).
Using COUNTIF to Count Blank Cells in Excel
You can also use COUNTIF and create a condition to count blank cells. By using the same example, you can follow the below steps to write this formula:

=COUNTIF(A1:A10,"=")
- First, in cell B1, start typing the COUNTIF function (=COUNTIF), and enter the starting parenthesis.
- Now, refer to the range A1:A10 from where you want to count the cells with no value.
- Next, in the criteria argument, type “=”. This equals operator tells Excel to count cells where you have no value, because after the = operator, you have not specified anything.
- After that, type the closing parenthesis and hit enter.
And the moment you hit enter, it returns the count of blank cells.
Read Also – Count Cells by Color in Excel

=COUNTIF(A1:A10,"=")
In this formula, COUNTIF checks each cell in the range A1:A10 to see if it matches the criteria specified, which in this case is “=” (meaning the cell is empty).
You can also use a formula like the following with the “=”&”” criteria. When you use it, it also tells Excel to count only cells with no value in them.
=COUNTIF(A1:A10,"="&"")
There’s one difference to know here: with “=” as the criteria, COUNTIF counts only the cells that are truly empty. If you use “” instead, it also counts cells with a formula that returns a blank (“”):
=COUNTIF(A1:A10,"")

Blank Cells which are Truly Blank
When using the COUNTIF function to count blank cells, it’s important to note that COUNTIF doesn’t consider cells with spaces to be blank.
If a cell has a space (or spaces) in it that might look empty to you, COUNTIF will not count it as blank.

To count cells that are truly empty or contain only spaces, you can make a little change to the formula:
=COUNTIF(B2:B21, "") + COUNTIF(B2:B21, " ")
This formula has two parts:
- COUNTIF(B2:B21, “”): This counts completely empty cells in the range B2:B21 (and cells with a formula that returns “”).
- COUNTIF(B2:B21, ” “): This counts cells in the range B2:B21 that contain only a single space.
By adding these two counts, you get the total number of cells that are either empty or contain a single space. A cell with two or more spaces isn’t counted; for that, use the SUMPRODUCT formula with TRIM below.
Custom Formula to Count Blank Cells
You can also use the below code to create a custom function in Excel that counts blank cells and also counts the cells where you have single or multiple spaces as blank.
Function CountTrueBlank(rng As Range) As Integer Dim cell As Range Dim count As Integer count = 0 For Each cell In rng If Trim(cell.Value) = "" Then count = count + 1 End If Next cell CountTrueBlank = count End Function
Use SUMPRODUCT to Count Blank Cells
This formula counts blank cells in the range A1:A21.
=SUMPRODUCT(--(A1:A21=""))
This formula counts the number of blank cells in the range A1 to A21 by converting empty cells to 1 and non-empty cells to 0, and then summing the results. It also counts cells with a formula that returns .
=SUMPRODUCT(--(LEN(TRIM(A1:A21))=0))
It counts the number of blank cells in the range A1:A21, including cells with only spaces, by trimming spaces and checking if the length is 0, then summing the results using the SUMPRODUCT.
COUNTBLANK to Count Blank Cells
In the following example, you have a few values in the range A1:A10, but a few of the cells are empty. And now, you need to count those cells with no values in them.

You can use the following steps to write this formula:
- First, in cell B1, start typing the COUNTBLANK function (=COUNTBLANK).
- After that, type the starting parenthesis.
- Now, refer to the range A1:A10 in the function.
- In the end, type a closing parenthesis and hit enter.

Once you hit enter, it returns the count of the cells that are blank in the specified range. Note that COUNTBLANK also counts cells with a formula that returns “” as blank, but not cells with a space or a zero.

Use FILTER to Count Blank Cells
With Excel’s dynamic array formulas (Excel 2021, Excel 2024 and Microsoft 365), you can write a formula using the FILTER function. Here’s how you can count blank cells, including those with only spaces, using dynamic array formulas:
=IFERROR(ROWS(FILTER(A1:A21, TRIM(A1:A21) = "")), 0)
- TRIM(A1:A21) = “”: This part of the formula checks each cell in the range A1 to A21 after trimming spaces. If a cell is empty or contains only spaces, it evaluates to TRUE; otherwise, it evaluates to FALSE.
- FILTER(A1:A21, TRIM(A1:A21) = “”): The FILTER function filters the range A1 to A21 based on the condition specified, returning an array of cells that meet the criteria (empty or with spaces only).
- IFERROR(ROWS(…), 0): Finally, ROWS counts the rows in the filtered array. When there are no blank cells, FILTER returns the #CALC! error, so IFERROR returns 0 instead. (COUNTBLANK can’t be used here, as it only accepts a range, not the array that FILTER returns.)
Count Blank Cells with a Condition
Back to the students’ example: if you want to count only the students who have a name in column A but no score in column B, use COUNTIFS with two conditions. The “<>” criteria means “not empty”:
=COUNTIFS(A2:A21,"<>",B2:B21,"")
Which Method to Use
- COUNTBLANK or COUNTIF with “”: count empty cells and cells with a formula that returns “”.
- COUNTIF with “=”: counts only the cells that are truly empty.
- SUMPRODUCT with LEN and TRIM: also counts cells with one or more spaces as blank.
- COUNTIFS: counts blank cells that meet another condition.
Frequently Asked Questions
Does COUNTBLANK count cells with zero?
No. A cell with 0 has a value, even if you hide zeros with a number format, so COUNTBLANK doesn’t count it.
Why is my blank count wrong?
Usually because some cells only look empty: they have a space, or a formula that returns “”. Check a cell with =LEN(A1) to see if it has any characters, and pick the method from the list above that treats those cells the way you want.
How do I count cells that are not blank?
Use COUNTA, or COUNTIF with “<>” as the criteria. See COUNTIF Cell is Not Blank for all the methods.
Read Next
COUNTIF IF Greater Than 0 – COUNT IF Less Than – COUNTIF Cell is Not Blank – COUNTIF Not Equal To – COUNTIF OR – COUNTIFS Between Two Numbers
Written by
Puneet Gogia
Microsoft MVP — Excel · Founder, Excel Champs
Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.