Sub topic 2
Counting numbers with COUNT
This chapter assumes you can enter formulas in Google Sheets and read cell addresses such as B2. It also assumes you know that a range such as B2:B6 is a block of cells.
Counting numbers with COUNT
COUNT returns how many cells in a range hold a number. It skips every other kind of content.
=COUNT(B2:B6)If B2:B6 holds 12, "n/a", 7, a blank cell, and 30, the result is 3.
Finding extremes with MIN and MAX
MIN returns the smallest numeric value in a range. MAX returns the largest.
=MIN(B2:B6)
=MAX(B2:B6)If a range holds no numbers, both functions return 0. Check for this case before you trust a result.
Combining several ranges and values
Each function accepts several arguments, separated by commas. Ranges and single values can be mixed in one call.
=SUM(B2:B6, D2:D6, 100)
=COUNT(B2:B6, D2:D6)COUNT counts numbers across both ranges. Each typed value counts as one item.
What the functions ignore: text, blanks, and zeros
These functions handle each kind of cell content differently:
| Cell content | Counted by COUNT | Used by MIN and MAX |
|---|---|---|
| 42 (a number) | Yes | Yes |
| Blank cell | No | No |
| "n/a" (text) | No | No |
| '42 (a number stored as text) | No | No |
| 0 (zero) | Yes | Yes |
Zero is a number, so these functions do not skip it.
Exercise
Exercise
Column B holds 4, a blank cell, the text '7, 0, and 9 in rows 1 to 5. What do =COUNT(B1:B5) and =MIN(B1:B5) return?
Show answer
=COUNT(B1:B5) returns 3, because it counts 4, 0, and 9 and skips the blank cell and the text '7. =MIN(B1:B5) returns 0, because 0 is the smallest numeric value.