Purpose
Return value
Syntax
=COUNTBLANK(range)
- range - The range in which to count blank cells.
How to use
The COUNTBLANK function returns a count of empty cells in a range. Cells that contain text, numbers, errors, spaces, etc. are not counted. Formulas that return an empty string ("") are counted as blank. COUNTBLANK takes just one argument, range, which must be a cell range.
Examples
In the example shown, the formula in cell E6 is:
=COUNTBLANK(B5:B15) // returns 3
COUNTBLANK returns 3 since there are 3 blank cells in the range. Note that cell B12 is not included because it contains a space character (" "). Cell B13 contains a formula that returns an empty string:
="" // formula in B13
COUNTBLANK considers B13 blank and includes it in the count.
Formulas that return empty strings
The IF function is often used to return empty strings. For example, if A1 contains 21, this formula in B1 will return an empty string:
=IF(A1>30,"Overdue","")
The idea is that that cell B1 should be empty unless the value in A1 is greater than 30. The COUNTBLANK function will indeed count B1 as empty when the value in A1 is less than or equal to 30. However it's worth noting that COUNTA and COUNTIFS will count B1 as not empty in the same case. In other words they will see the empty string ("") returned by IF as not blank.
Invisible characters
Some cells look empty, but actually contain invisible characters. To check which cells are blank use Go To > Special > Blanks:
- Select a range
- Open Go To dialog (Control + G)
- Press "Special"
- Select "Blanks"
Functions for counting
- To count numbers only, use the COUNT function.
- To count numbers and text, use the COUNTA function.
- To count with one condition, use the COUNTIF function
- To count with multiple conditions, use the COUNTIFS function.
- To count empty cells, use the COUNTBLANK function.
Notes
- Cells that contain text, numbers, errors, etc. are not counted.
- Cells with formulas that return an empty string ("") are counted.
- Cells that contain only a single quote (') are counted.
- Cells that contain zero are not counted.