COUNTA Function – Google Sheets

The COUNTA function counts the non-blank cells in a specified range. You can use it to find the number of cells containing text, numbers, images, boolean values, errors, and more.

When all inputs to the function are numbers, it produces the same result as the COUNT function. However, when the inputs are text or boolean values, the COUNTA function acts differently than COUNT. Get your copy of the template used in this tutorial to follow along.

Purpose

The COUNTA function returns the number of non-blank cells in a data set.

Syntax

=COUNTA(value1, [value2, ...])

  • value1 – The first value or range to consider while counting.
  • value2, … – [OPTIONAL] Additional values to consider.

Examples

Example 1 – Counting Numbers

Using COUNTA on numbers
Just Numbers

Four numerical values are in the image above, and the formula returns the number 4. Counting numbers is a straightforward use of the function.

Example 2 – Counting Blanks vs. Counting Zeroes

The COUNTA function will treat blanks differently from zeroes as we move into the following example. A blank cell does not have a data type, but 0 is a number.

Zeroes compared to blanks being counted with the COUNTA function
Blanks vs. Zeros

While 0 is a number, you may not intend to count it. If you only want to count numbers greater than zero, you may consider using a formula such as =COUNTIF(B2:B5,">0").

What if we had a mix of different data types?

Example 3 – Counting Mixed Data Types

Using the COUNTA function to count different data types
Mixed Data Types

The COUNTA function sees a value in every cell in the range (A2:A5).

Example 4 – Counting More Data Types

COUNTA will recognize more than just text, images, boolean values, and numbers.

Counting different types of data
Different Data Types

The COUNTA function does not care if a date is valid. Unlike COUNT, Google Sheets includes correct and invalid dates in its calculation.

Let’s take a closer look at non-printing characters like the space in A5.

Example 5 – Counting Non-Printing Characters

Invisible characters (AKA non-printing) such as spaces can be a hassle when importing data from other sources.

Invisible characters in the COUNTA function
Non-Printing Characters

Even though you can’t see them, they are text characters and, therefore, the function will count them as shown above.

Live Examples in Sheets

Go to this spreadsheet for examples of the COUNTA functions shown above that you can study and use anywhere you would like.

Notes

  • COUNTA does not count blank cells.
  • The COUNTA function counts every cell with any content as 1.
  • Consider using the SUBTOTAL function if you have multiple counts in one column.

Related Tutorials

Leave a Comment