Sub topic 8
What the functions ignore: text, blanks, and zeros
Assume you can enter data and formulas in Google Sheets and can read cell addresses such as B2. This chapter focuses on how aggregate functions treat different kinds of cell contents. An aggregate function summarizes several values into one result.
A test range
Create this small table in columns A and B:
| Cell | Displayed value | Stored as |
|---|---|---|
| B2 | 12 | Number |
| B3 | 13 | Text |
| B4 | *(empty)* | Blank |
| B5 | 0 | Number |
| B6 | late | Text |
To store 13 as text, type an apostrophe before it, such as '13. The apostrophe is not displayed, but it makes the cell text instead of a number.
Now enter these formulas:
=SUM(B2:B6)
=AVERAGE(B2:B6)
=COUNT(B2:B6)
=MIN(B2:B6)
=MAX(B2:B6)The results are:
| Function | Result | Reason |
|---|---|---|
| SUM | 12 | Adds 12 and 0 |
| AVERAGE | 6 | Averages 12 and 0 |
| COUNT | 2 | Counts two numeric cells |
| MIN | 0 | Includes zero as a number |
| MAX | 12 | Ignores text and uses the largest number |
What each function includes
When these functions receive a range, they generally ignore blank cells and text cells. They do not ignore zeros because zero is a valid number.
- SUM adds numeric values.
- AVERAGE adds numeric values and divides by their count.
- COUNT counts numeric values only.
- MIN returns the smallest numeric value.
- MAX returns the largest numeric value.
A number stored as text is not the same as a number. For example, the displayed values 13 and '13 may look identical, but COUNT and SUM treat them differently. If B3 becomes a real number, SUM becomes 25, AVERAGE becomes 8.33, COUNT becomes 3, MIN remains 0, and MAX becomes 13.
A blank cell contributes nothing to these five functions. However, do not confuse a blank with zero. A blank means no value was entered. Zero means a value was entered and its value is 0.
> callout note > If a formula returns an empty string, such as ="", the cell can behave differently from a truly empty cell in counting functions. When missing data matters, test the actual cell contents instead of relying only on what appears on screen.
Diagnose unexpected results
If a total is lower than expected, check whether some numbers are stored as text. Select the cells and look for clues such as left alignment, an apostrophe in the formula bar, or an error indicator. You can convert text to numbers by re-entering the values or using a conversion formula such as =VALUE(B3) when the text has a valid numeric format.
If AVERAGE returns #DIV/0!, the referenced range contains no numeric values. Text and blanks do not provide a divisor. You can show a clearer message with:
=IFERROR(AVERAGE(B2:B6), "No numeric data")Use COUNT when you need the number of numeric entries. Use COUNTA when you need the number of non-empty entries, including text. Use COUNTBLANK when you need to find missing cells.
Exercise
In B2:B6, the cells contain 8, '10, a blank, 0, and "pending". What do SUM, AVERAGE, COUNT, MIN, and MAX return?
Show answer
SUM returns 8, AVERAGE returns 4, COUNT returns 2, MIN returns 0, and MAX returns 8. The text 10 and "pending" and the blank are ignored. Zero is included.