Syntax. COUNTBLANK(area)
Definition. This function counts the empty cells in a cell range.
Arguments
area (required). The reference to the cells that you are testing for empty cells
Background. This function counts not only the empty cells but also the cells containing empty strings. Cells containing the value 0 are not counted. This function is related to the COUNTIF() function. However, the COUNTIF() function evaluates numbers and text differently.
The COUNTBLANK() function is also included in Chapter 12.
Example. Perform a few tests to get familiar with this function. Assume cells B2 through B8 contain a, b, =””, nothing, 0, 1, and 2:
COUNTBLANK(B2:B8)
returns 2
because the function counts B4 and B5 as empty cells.
COUNTIF(B2:B8,">0")
also returns 2
, because two cells contain numbers greater than 0.
COUNTIF(B2:B8,">""")
returns 2
because the cells B2 and B3 contain non-empty strings.
COUNTIF(B2:B8,"=0")
returns 1
because only B6 contains 0.
However, COUNTIF(B2:B8,"=""")
returns 0
, and COUNTIF(B2:B8,"=")
returns the expected value 1
, because cell B5 is empty.
Sample Files
Use the Misc worksheet in the Information.xls or Information.xlsm sample file. The sample files are found in the Chapter11 folder. For more information about the sample files, see the section titled Using the Sample Files.
3.129.42.243