Sub topic 6
Counting numbers with COUNT
This chapter assumes you can enter values in cells, select ranges, and start a formula with an equals sign. You should also know the basic shape of a function call from the earlier chapter on function syntax.
What COUNT does
COUNT returns how many cells in its arguments hold a number. It does not add the numbers. It only tallies them. Dates and times count as numbers too, because Excel stores them as numbers.
=COUNT(B2:B6)If B2:B6 holds 10, 20, 30, a blank cell, and the word n/a, the result is 3.
What COUNT counts and skips
Which cells are counted depends on how they are stored, not how they look. This table shows the common cases when the values sit in a range.
| Cell content | Counted by COUNT? | Why |
|---|---|---|
| `42` | Yes | A number |
| `0` | Yes | Zero is still a number |
| `12/03/2026` | Yes | A date is a number underneath |
| Blank cell | No | Nothing to count |
| `n/a` (text) | No | Text is skipped |
| `'42` or `"42"` stored as text | No | It looks like a number but is text |
| `TRUE` or `FALSE` in a cell | No | Logical values in a range are skipped |
| `#N/A` in a range | No | Error values in a range are skipped |
COUNT skips an error in a range instead of returning it. This differs from SUM, which passes the error through.
Using COUNT in a formula
COUNT is useful as a check on other formulas. Compare it with the number of rows you expect. If you expect five readings but COUNT returns four, one value is probably stored as text.
You can also use COUNT to guard AVERAGE. This formula avoids the #DIV/0! error when the range holds no numbers:
=IF(COUNT(B2:B6)=0, "No data", AVERAGE(B2:B6))COUNT also shows how AVERAGE is built. These two formulas return the same value:
=AVERAGE(B2:B6)
=SUM(B2:B6)/COUNT(B2:B6)How COUNT sees a range
The diagram shows how COUNT sorts each cell in the range B2:B6.
Worked example
Suppose B2:B6 contains these values from top to bottom: 15, 0, the text pending, an empty cell, and 22.
=COUNT(B2:B6)The result is 3. The cells with 15, 0, and 22 are numbers. The text and the empty cell are skipped. Notice that the zero is counted, so a zero is not the same as a missing value.
Common errors
- A count lower than expected. Numbers imported from other systems are often stored as text. Look for a green triangle in the cell corner or left-aligned values. Convert them to numbers.
- Confusing COUNT with COUNTA. COUNT only counts numbers. To count every non-empty cell, including text, use COUNTA, which the next chapter covers.
- A result of 0 on a range that looks full. Every value in the range is probably text or an error.
- Expecting COUNT to return an error. COUNT with no numbers returns
0, not an error. Only formulas that divide by it, such as the SUM/COUNT form above, return#DIV/0!.
Exercise
Range C2:C7 contains 8, 0, TRUE, the text "12" (stored as text), a blank cell, and #N/A. What does =COUNT(C2:C7) return, and why?
Show answer
It returns 2. Only 8 and 0 are numbers. TRUE is a logical value in a range, "12" is text, the blank has no content, and #N/A is an error. COUNT skips all four.
Exercise
Write a formula that returns the text "No data" when B2:B6 has no numbers, and otherwise returns the average of B2:B6. Why does it use COUNT?
Show answer
=IF(COUNT(B2:B6)=0, "No data", AVERAGE(B2:B6)). COUNT returns 0 when the range has no numbers, and AVERAGE would return #DIV/0! in that case. Testing COUNT first avoids the error.