Count cells that are blank

This tutorial shows how to count cells that are blank through the use of an Excel formula or VBA

Example: Count cells that are blank

Count cells that are blank

METHOD 1. Count cells that are blank

EXCEL

=COUNTBLANK(C5:C11)
This formula uses the Excel COUNTBLANK function to count the number of blank cells in range (C5:C11).

METHOD 1. Count cells that are blank using VBA

VBA

Sub Count_cells_that_are_blank()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to count cells that are blank
ws.Range("C13") = Application.WorksheetFunction.CountBlank(ws.Range("C5:C11"))

End Sub

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("C13") in the VBA code.
Range: Select the range from which you want to count blank cells by changing the range reference ("C5:C11") in the VBA code.
Worksheet Selection: Select the worksheet which captures a range of cells from which you want to count the number of blank cells by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.

Explanation about the formula used to count cells that are blank

EXPLANATION

EXPLANATION
Both the Excel and VBA methods use the COUNTBLANK function to count the number of blank cells in a selected range.
FORMULA
=COUNTBLANK(range)
ARGUMENTS
range: A range of cells from which you want to count the number of blank cells.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to test if a cell contains text and return a specified value using Excel and VBA methods
How to count cells that contain text using Excel and VBA methods
How to count cells that do not contain a specific value using Excel and VBA methods
How to count cells that contain a specific value using Excel and VBA methods
How to count cells that are not blank using Excel and VBA methods

RELATED FUNCTIONS

Related Functions Description Related Functions and Description
The Excel COUNTBLANK function returns the number of empty cells from a specified range