How to Count the Number of Cells in a Range in Google Sheets

Published on

Google Sheets has no specific function to count the number of cells in a range directly. However, you can achieve this by using certain function combinations. There are two main options: multiplying the number of rows and columns in the range, or conditionally counting the cells. We will explore both options.

Count the Number of Cells Using ROWS and COLUMNS Functions

Let’s say you want to find how many cells are in the range A1:C10.

You can use one of the following formulas:

=ROWS(A1:C10)*COLUMNS(A1:C10)

or

=SUMPRODUCT(ROWS(A1:C10), COLUMNS(A1:C10))

In these formulas:

By multiplying the two, you get the total number of cells in the specified range.

Example to Count Number of Cells in a Range in Google Sheets

Count the Number of Cells Using the COUNTIF Function

Another method to count the number of cells in a range is by using the COUNTIF function.

=ARRAYFORMULA(COUNTIF(A1:C10&"", "*"))

In this formula:

  • We concatenate an empty string (&"") to the range A1:C10 to ensure it is considered non-blank. This allows the COUNTIF function to count the cells in the range.
  • The asterisk (*) is a wildcard that represents any number of characters (including none), which makes it useful for counting all cells.

This formula will return the total number of cells in the range that are non-blank.

Real-Life Use

You can use the formula above to check if all cells in the range are filled or not.

For example, to check if all cells in the range A1:C10 are non-empty, use the following formula:

=COUNTA(A1:C10)=ROWS(A1:C10)*COLUMNS(A1:C10)

This will return TRUE if all cells are filled and FALSE if any cell is empty.

  • The first part, COUNTA(A1:C10), counts the number of non-empty cells.
  • The second part, ROWS(A1:C10) * COLUMNS(A1:C10), gives the total number of cells in the range.

You can also modify this formula to check for specific values. For example, to check if all cells in the range A1:C10 contain the word “Apple,” use:

=COUNTIF(A1:C10, "Apple")=ROWS(A1:C10)*COLUMNS(A1:C10)

This will return TRUE if every cell in the range contains “Apple.”

Conditional Formatting

If you want to apply conditional formatting based on the above evaluations, remember to use absolute references for the range.

For example, to highlight any cell (e.g., D1) if all cells in A1:C10 contain “Apple,” use the following formula:

=COUNTIF($A$1:$C$10, "Apple")=ROWS($A$1:$C$10)*COLUMNS($A$1:$C$10)

To apply the rule:

  1. Navigate to cell D1.
  2. Click Format > Conditional formatting.
  3. Select Custom formula is under Format Rules, and enter the above formula.
Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

How to Extract Numbers from Text in Excel with Regex

You can use the REGEXEXTRACT or REGEXREPLACE functions to easily extract numbers from text...

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

How to Use OFFSET and XMATCH Functions Together in Excel

We often use the OFFSET and XMATCH functions together to match a value in...

How to Calculate Maximum Drawdown in Excel and Google Sheets

You can use the following dynamic array formula to calculate maximum drawdown (MDD) in...

More like this

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

Running Count with Structured References in Google Sheets

Running a count with structured references is achievable in Google Sheets tables using the...

Running Total with Structured Table References in Google Sheets

You can use two types of formulas to create a running total with structured...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.