How to Count the Number of Cells in a Range in Excel (6 Easy Ways)

Method 1 – Using the Excel COUNTA Function 

Below, 3 columns and 8 rows show sales of multiple venders in different regions.

Method 1: Use Excel COUNTA Function to Count Number of Cells in a Range

Steps:

  • Select cell
  • Enter the following formula in the cell:
=COUNTA(B5:D11)
  • Press Enter.


Method 2 – Inserting the COUNT Function 

In the below dataset, we will count the number of cells in the Sales column.

Steps:

  • Select cell
  • Enter the following formula in the cell:
=COUNT(D5:D11)
  • Press Enter.

We see 7 cells under the “Sales” header.

Method 2: InsertUse COUNT Function to Count Number of Cells in a Range in Excel


Method 3 – Entering the COUNTBLANK Function

In the below dataset, some region names are removed to show how to count blank cells using the Countblank Function.

Steps:

  • Select cell
  • Enter the following formula in the cell:
=COUNTBLANK(B5:D11)
  • Press Enter.

The number of blank cells is 3.

Method 3: Enter COUNTBLANK Function to Count Number of Blank Cells in a Rang


Method 4 – Applying the COUNTIFS Function 

In the below dataset, there are two ranges of sales. The Countifs Function is used to count cells that meet specified criteria.

Step 1:

  • Select cell
  • Enter the following formula in the cell:
=COUNTIFS($D$5:$D$11,">="&F5,$D$5:$D$11,"<="&G5)
  • Press Enter.

Method 4: Apply COUNTIFS Function to Count Number of Cells with Conditions in Excel

Step 2:

  • Use the Fill Handle to copy the formula to the next criteria range.


Method 5 – Combining the COLUMNS and ROWS Functions 

In the below dataset, we will use multiple functions to count total cells in a range. We will use the columns and rows functions.

Steps:

  • Select cell
  • Enter the following formula in the cell:
=ROWS(B5:D11)*COLUMNS(B5:D11)
  • Press Enter.

Method 5: Combine COLUMNS and ROWS Functions to Count Total Cells in a Range


Method 6 – Embedding Excel VBA

In the below dataset, we’ll use Excel VBA to count the total cells.

Step 1:

  • Right-click on the sheet title name.
  • Select View Code from the context menu.
  • A Microsoft VBA window will open up.

Method 6: Embed Excel VBA Codes to Count Total Cells in a Range

Step 2:

  • Enter the following formula in the cell:
Option Explicit
Sub CountCells()
End Sub
Function CountAllCells(rng As Range)
CountAllCells = rng.CountLarge
End Function

Step 3:

  • Press the Play button to run the codes.

A new window will appear – “Macros”

  • Press Run.
  • Close the VBA

Step 4:

  • Select cell
  • Enter the following formula into the cell:
=CountAllCells(B5:D11)
  • Press Enter.

In the image below, we have our total cell numbers with our new function.


Download Practice Book

Download the Excel workbook to practice.


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

Get FREE Advanced Excel Exercises with Solutions!
Md. Sourov Hossain Mithun
Md. Sourov Hossain Mithun

Md. Sourov Hossain Mithun, an Excel and VBA Content Developer at Softeko's ExcelDemy project, joined in October 2021. Holding a Naval Architecture & Marine Engineering degree from BUET, Mithun showcases expertise during his two-year tenure. With over 200 published articles on Excel topics, he earned a promotion to Team Leader, excelling in leading diverse teams. Mithun's passion extends to Advanced Excel, Excel VBA, Data Analysis, and Python programming, contributing significantly to the innovative and dynamic environment of ExcelDemy... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo