How to Count Empty Cells in Excel (4 Suitable Ways)

We will use the following dataset to explain how to count empty cells in Excel.

Excel count empty cells: Sample dataset


Method 1 – Count Empty Cells by Inserting Functions

Case 1 – Using COUNTBLANK to Count Empty Cells

  • The formula for D5:

=COUNTBLANK(B5:C5)

Result of inserting COUNTBLANK formula

  • Drag the plus (+) sign at the bottom-right of the cell (B5).

Inserting COUNTBLANK to Count Empty Cells

Formula Description:

The formula syntax:

=COUNTBLANK(range)

The range indicates the dataset from where you want to count the empty cells.

You can also use the nested IF and COUNTBLANK formulas to find whether the row is fully blank or not.

The formula will be:

=IF(COUNTBLANK(B5:C5)=0,"Not Blank","Blank")

Use of nested IF and COUNTBLANK formula

Formula Description:

=IF(logical_test,[value_if_true],[value_if_false])

logical_test takes the COUNTBLANK function and checks whether it is equal to zero or not.

value_if_true takes a text to display if the test is true.

value_if_false takes a text to display if the test is false.


Case 2 – Using COUNTIF or COUNTIFS to Count Empty Cells

The formula in D5 will be:

=COUNTIF(B5:C5,"")

OR

=COUNTIFS(B5:C5,"")

Drag the fill handle down to find the count for the rest of the rows in the dataset.

Comparing result for COUNTIF and COUNTIFS

Formula Explanation:

=COUNTIF(range, criteria)
=COUNTIFS(criteria_range1, criteria1, [criteria_range2], [criteria2]..)

Both of the formulas take a range of the dataset and criteria based on which result will be displayed.


Case 3 – Using SUM with ROWS and COLUMNS to Count Empty Rows

  • The formula is:
=SUM(--MMULT(--(B5:C11<>""),ROW(INDIRECT("B1:B"&COLUMNS(B5:C11))))=0)

Inserting SUM with ROWS and COLUMNS to Count Empty Cells

  • The result shows there are two blank rows in the dataset.

Formula Explanation:

=SUM(number1, [number2],..)

The formula takes the numbers as arguments and gives the sum as a result.

=MMULT(array1,array2)

It takes a number of arrays of the dataset.

=ROW([reference])

The formula with the ROW function takes the reference of rows in the dataset.

=INDIRECT(ref_text,[a1])

This makes a reference from text.

=COLUMNS(array)

The formula with the COLUMNS function takes an array of the dataset.

The double minus (–) sign is used for a forced conversion of the Boolean value TRUE or FALSE to numerical values 1 or 0.


Case 4 – Inserting SUMPRODUCT to Count All Empty Cells

  • The formula for the given dataset will be:
=SUMPRODUCT(--B5:C11="")

Inserting SUMPRODUCT to Count Empty Cells

  • The result shows there are 5 empty cells in the given dataset.

Formula Explanation:

=SUMPRODUCT(array1, [array2],..)

The function is used to take multiple arrays and provide the sum of the arrays.

We have only one set of arrays and the formula takes the range of the dataset only if it is equal to blank.

The double minus (–) converts it into numerical value to get the result.


Method 2 – Count Empty Cells with the Go To Special Command

  • Select the dataset.
  • Select Go To Special from Find & Select. You will find Find & Select from the Editing options present in the Home tab.

You can also press F5 on your keyboard to find Special from there.

Count Empty Cells Using the Go To Special Command

  • A new box will appear. Select Blanks and click OK.

Selecting blank from Go To Special

The blank cells are selected automatically.

Selected blanks in the dataset

  • To highlight the blank cells from the Home tab, select Fill Color and choose the color you like from the drop-down menu.

Choosing color to highlight the selected cells

The color you chose will fill the selected blank cells. We chose blue for now. The result will look like this.

Result of using Go To Special


Method 3 – Count Empty Cells Using the Find & Replace Command

  • Select the dataset.
  • Select Find from Find & Select.

Choosing Find from home tab

  • A new box will appear. Keep the box Find what: blank.
  • Click on Options >>.

Count Empty Cells Using the Find & Replace Command

  • Tick the option Match entire cell contents.
  • From Within: drop-down options, select Sheet.
  • In Search: drop-down options select By Columns.
  • From Look in drop-down options, select Values or Formulas.

Selecting required options and clicking Find All

  • The Find and Replace box should look like the below picture.
  • Click Find All and the result will be shown at the bottom of the box.

Result showing at the bottom


Method 4 – Count Empty Cells Using Excel VBA

  • Select the dataset.

Selecting dataset to apply VBA MACRO

  • Press Alt + F11. The VBA window will open.

Opening the VBA window

  • Select the sheet where your selected dataset is present.
  • From Insert, choose Module.

Selecting Module to open General window

  • The General window will open.

 The general window where code has to be written

  • Insert the code given below.

Code:

Sub CountBlanks()
'Updateby20140310
Dim rng As Range
Dim WorkRng As Range
Dim total As Long
On Error Resume Next
xTitleId = "Number of Blank Cells"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each rng In WorkRng
    If IsEmpty(rng.Value) Then
        total = total + 1
    End If
Next
MsgBox "There are " & total & " blank cells in this range."
End Sub

Count Empty Cells Using Excel VBA Macros

  • Press F5 from the keyboard to run the code.
  • This will open a box named “Number of Blank Cells”.
  • Check or insert the Range of your dataset and click OK.

Checking range of dataset

  • A new box will show the result.

Result of using VBA MACRO


Download the Practice Workbook


<< Go Back to Count Cells | Formula List | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Syeda Fahima Nazreen
Syeda Fahima Nazreen

SYEDA FAHIMA NAZREEN is an electrical & electronics engineer who loves exploring Excel and VBA programming. To her, programming is a time-saving tool for dealing with data, files, and the internet. She's skilled in Proteus, MATLAB, Multisim, AutoCAD, Jupiter Notebook, and MS Office, going beyond the basics. With a B.Sc in Electrical & Electronic Engineering from American International University, Bangladesh, she's shifted gears and now works as a content developer. In this role, she creates techy content exclusively... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo