Excel COUNTBLANK Function

The Excel COUNTBLANK function returns the number of empty cells from a specified range

Example: Excel COUNTBLANK Function

Excel COUNTBLANK Function

METHOD 1. Excel COUNTBLANK Function

EXCEL

=COUNTBLANK(C5:C11)
Result in cell C12 (3) - returns the number of empty cells from the selected range.

METHOD 2. Excel COUNTBLANK function using the Excel built-in function library

EXCEL

Formulas tab > Function Library group > More Functions > Statistical > COUNTBLANK > populate the input box

=COUNTBLANK(C5:C11)
Note: in this example we are populating the Range input box with a single range.
Built-in Excel COUNTBLANK Function

METHOD 1. Excel COUNTBLANK function using VBA

VBA

Sub Excel_COUNTBLANK_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("COUNTBLANK")
'apply the Excel COUNTBLANK function
ws.Range("C12") = Application.WorksheetFunction.CountBlank(ws.Range("C5:C11"))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named COUNTBLANK.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the Range reference ("C12") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

Usage of the Excel COUNTBLANK function and formula syntax

EXPLANATION

DESCRIPTION
The Excel COUNTBLANK function returns the number of empty cells from a specified range.
SYNTAX
=COUNTBLANK(range)
ARGUMENTS
range: (Required) A range of cells.

ADDITIONAL NOTES
Note 1: Cells that contain a formula that return empty text (" ") will be captured in the COUNTBLANK formula as an empty cell.