The COUNT function counts the numeric values in a data set. When all inputs to the function are numbers, it produces the same result as the COUNTA 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.
Contents
Purpose
The COUNT function returns the number of numerical values in a data set.
Syntax
=COUNT(value1, [value2, ...])
value1
– The first number or range to consider while counting.value2, …
– [OPTIONAL] Additional numbers to consider.
Video Explanation
Similar Functions
COUNT – Count the numeric values in a data set
COUNTA – Count the non-blank values in a data set
COUNTIF – Count the cells that match a criterion
COUNTIFS – Count the cells that match multiple criteria
COUNTUNIQUE – Count the unique values
COUNTUNIQUEIFS – Count the unique values that meet multiple criteria
COUNTBLANK – Count the blank cells
Insert Math Symbols (Add-On)
Examples
Example 1 – Counting Numbers
The four numerical values in the range of A2
to A5
are counted and the formula returns the number 4
. Counting numbers is the most straightforward use of the function.
Example 2 – Counting Blanks vs. Counting Zeroes
The COUNT function treats blanks differently from zeroes as we move into the following example. Blank cells, such as those in A4
and A5
are not counted, but a cells with 0
s like B4
and B5
are counted as number values.
While 0
is a number, you may not intend to count it. If you only want to capture numbers greater than zero, you may consider using a formula such as =COUNTIF(B2:B5,">0")
. Read about the COUNTIF function here.
What if we had a mix of text and numbers?
Example 3 – Count Text and Numbers
The COUNT function only sees one number, the 7
in A5
, in the range A2:A5
. As shown in the previous example, the function does not count the blank cell in A3
. Also, the function ignores the text values of Nice day
in A2
and 5 stars
in cell A4
as they are both text strings instead of numbers. The text value 5 stars
contains the number 5
, but having the text stars
after the 5
converts the value to text.
If you want to find the amount of text and number values while ignoring the blanks, consider the COUNTA function.
Example 4 – Counting Dates
Now let’s move on to dates. Remember, spreadsheets treat dates the same as numbers in a spreadsheet.
The trick with dates is that they need to be valid to be considered a number. In the example above, Google Sheets adds 1 for each date in A3:A5
but it does not recognize Feb 20th
in cell A2
as a valid date. You can tell because Feb 20th
is left-aligned, which is how spreadsheets show text values. Also, for a spreadsheet to treat a date as a number, it must have a year.
Numbers and text are relatively common in spreadsheets, but you can also have boolean values.
Example 5 – Count Boolean Values
Boolean values only have two options – TRUE or FALSE.
The COUNT function is not adding any of the values in cells A2:A5
. So, boolean values just aren’t counted, right? Not so fast. The COUNT function disregards them if they are in cells referenced by the COUNT function but counts them if they are input directly into the function.
It makes no sense, right? Fortunately, values are typically referenced instead of input directly into a function.
Live Examples in Sheets
Go to this spreadsheet for examples of the COUNT functions shown above that you can study and use anywhere you would like.
Notes
- COUNT ignores blank cells.
- The COUNT function counts text as 0.
- Consider using the SUBTOTAL function if you have multiple counts in one column.