Excel COUNTBLANK Function
The Excel COUNTBLANK function returns the number of empty cells from a specified range
Example: Excel COUNTBLANK Function
=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. |
Sub Excel_COUNTBLANK_Function()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("COUNTBLANK")
'apply the Excel COUNTBLANK function
ws.Range("C12") = Application.WorksheetFunction.CountBlank(ws.Range("C5:C11"))
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.
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.
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.
DESCRIPTION
The Excel COUNTBLANK function returns the number of empty cells from a specified range.
The Excel COUNTBLANK function returns the number of empty cells from a specified range.
SYNTAX
=COUNTBLANK(range)
=COUNTBLANK(range)
ARGUMENTS
range: (Required) A range of cells.
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.