Sub topic 5
Counting numbers with COUNT
COUNT tells you how many cells in a range hold a number. It looks like the simplest function in this tutorial, but you will use it constantly, because the other functions depend on it. AVERAGE divides by it, and it is the quickest way to check whether your data is what you think it is. This chapter assumes you can enter formulas, write a range such as B2:B6, and read the FUNCTION(argument, argument) form from earlier chapters.
What COUNT does
COUNT returns the number of cells that contain numeric values. It does not add them or look at their size. It only asks whether each cell holds a number.
=COUNT(B2:B6)Suppose this is your sheet:
| Row | A (Item) | B (Units sold) |
|---|---|---|
| 2 | Apples | 120 |
| 3 | Pears | 85 |
| 4 | Plums | n/a |
| 5 | Cherries | (empty) |
| 6 | Figs | 200 |
=COUNT(B2:B6) returns 3. The cells B2, B3, and B6 hold numbers. B4 holds text, and B5 is empty, so neither is counted.
What counts as a number
Sheets stores several kinds of values as numbers, and COUNT counts all of them:
- Plain numbers such as
42,-7, and3.14. - Zero. A cell containing
0is a number and is counted. - Dates and times. Sheets stores a date as a number (days since a fixed starting date), so
2026-11-27counts. - Percentages and currency amounts, which are numbers with a display format.
- The results of formulas that return numbers.
COUNT skips these:
- Text, including words and labels such as
n/a. - Empty cells.
- Cells with an error such as
#DIV/0!or#N/A. - Numbers stored as text. These are the usual cause of surprises, so they get their own section below.
How COUNT decides, cell by cell
The function inspects each cell in the range once and increments a tally only when the cell's value is a number.
The link between COUNT, SUM, and AVERAGE
AVERAGE is the sum of the numbers divided by how many numbers there are. The "how many" is exactly what COUNT returns. With the sample data:
=SUM(B2:B6)
=COUNT(B2:B6)
=SUM(B2:B6) / COUNT(B2:B6)
=AVERAGE(B2:B6)The first formula gives 405, the second gives 3, and the last two both give 135. This equivalence is a useful check. If someone claims an average over five rows, and COUNT shows only three numbers, the average is based on three values. The other two cells were silently ignored.
A common mistake is dividing by the number of rows yourself. =SUM(B2:B6)/5 gives 81, which is wrong if you meant the average of the values that exist. AVERAGE and COUNT agree with each other. A hand-typed divisor does not follow the data.
Passing more than one range
COUNT accepts several arguments and counts the numbers across all of them.
=COUNT(B2:B6, D2:D6)You can also mix ranges, single cells, and literal values:
=COUNT(B2:B6, D2, 100)Here the range contributes its numeric cells. D2 contributes 1 if it holds a number. The literal 100 always adds 1. Because a literal number in the argument list is counted, =COUNT(B2:B6, 100) returns one more than =COUNT(B2:B6) for any range. Use literals this way only when you really want that effect, since they inflate counts without any data behind them.
If two ranges overlap, cells in the overlap are counted once for each range that contains them. =COUNT(B2:B4, B3:B6) counts B3 and B4 twice. Check your ranges when a total looks too high.
Numbers stored as text
A cell can look like a number but be text. This happens often with data pasted from other systems, exports from web pages, or values typed with a leading apostrophe ('123). COUNT does not count these cells, and neither do SUM or AVERAGE. They are ignored with no warning.
Signs that a cell is text and not a number:
- It is left-aligned by default (numbers are right-aligned).
- A leading apostrophe appears when you select the cell.
=ISNUMBER(B4)returnsFALSE.
To find the problem, compare two counts over the same range:
=COUNT(B2:B100)
=COUNTA(B2:B100)COUNTA counts every non-empty cell, text included. If the second number is larger and you expected only numbers, some cells hold text. To fix them, you can convert a value with VALUE:
=VALUE(B4)You can also use Format > Number > Automatic and re-enter the value. Chapter coverage of COUNTA and COUNTBLANK comes later; for now, treat COUNTA as the tool that exposes what COUNT skipped.
Zeros and blanks are different
A zero is data. An empty cell is the absence of data. They behave differently in COUNT and therefore in AVERAGE:
| Column B contents | COUNT | SUM | AVERAGE |
|---|---|---|---|
| 10, 20, 30 | 3 | 60 | 20 |
| 10, 20, 0 | 3 | 30 | 10 |
| 10, 20, (empty) | 2 | 30 | 15 |
If a missing value truly means zero, enter 0. If it means "unknown", leave the cell empty so it does not drag the average down. This is a data decision, and COUNT simply reports the result.
One more trap: a formula that returns an empty string, such as =IF(A2="", "", A2*2), produces text of zero length. The cell looks empty, but it is not empty. COUNT skips it because it is text, and COUNTA counts it.
Errors in the range
When a cell in the range holds an error, COUNT ignores that cell and carries on. Many other functions do not. For example, SUM(B2:B6) returns the error if any cell in the range is an error. This makes COUNT handy for diagnosis. If SUM fails, you can compare COUNT with COUNTA to see how many cells are not plain numbers.
COUNT also appears in the fix for a common error. AVERAGE returns #DIV/0! when the range holds no numbers, because there is nothing to divide by. You can guard against that with IFERROR, which comes up in a later chapter:
=IFERROR(AVERAGE(B2:B6), "No data")You can also test the count directly, which makes the reason explicit:
=IF(COUNT(B2:B6)=0, "No data", AVERAGE(B2:B6))The second version only hides the one case you meant to handle. IFERROR would hide every error, including ones you did not expect.
Practical patterns
Some uses of COUNT you will meet in real sheets:
- Completeness check. Compare the count with the number of expected rows:
=COUNT(B2:B6) & " of 5 entered". The&joins the number and the text into one string. - Sample size next to an average. Show
=COUNT(B2:B6)beside=AVERAGE(B2:B6)so readers know how many values stand behind the figure. - Counting dates.
=COUNT(C2:C100)counts the rows that have a real date entered, which is a quick way to count completed items. - Growing data. Use a range that covers future rows, such as
B2:B1000. Extra empty cells do not change the result.
Common mistakes
- Expecting COUNT to count text. To count labels, use
COUNTA.COUNTover a column of names returns0. - Counting all rows by counting a numeric column. Rows with missing or text values drop out. Count a column that is always filled in, using
COUNTA. - Assuming a formatted cell is a number. Check with
ISNUMBER. - Conditional counting.
COUNTcannot filter by a condition. To count values over100, you needCOUNTIF, which a later chapter covers.
Summary of behavior
COUNT(range)tallies numbers, dates, and times, and counts zeros.- It skips empty cells, text, text-formatted numbers, and errors.
- Several ranges and literal values can go in one call, and overlapping ranges are counted twice.
- It supplies the divisor behind
AVERAGE, so comparingCOUNTagainst your expected row count is a fast sanity check.
Exercise
Column B, rows 2 to 6, holds the values 40, 0, the text "n/a", an empty cell, and 60. What do =COUNT(B2:B6), =SUM(B2:B6), and =AVERAGE(B2:B6) return, and why is the average not 20?
Show answer
COUNT returns 3, because 40, 0, and 60 are numbers. The zero is counted, while "n/a" and the empty cell are skipped. SUM returns 100. AVERAGE returns 100 / 3, about 33.33, because it divides by the count of numbers (3), not by the 5 rows. Dividing by 5 would give 20, but that treats the text and blank cells as if they were values.
Exercise
You paste a column of 50 prices from a web page. =COUNT(B2:B51) returns 0 but =COUNTA(B2:B51) returns 50. What is the likely cause, and how can you confirm and fix it?
Show answer
The prices were pasted as text, so COUNT skips them while COUNTA counts every non-empty cell. Confirm with =ISNUMBER(B2), which returns FALSE. Fix by converting the values, for example with =VALUE(B2) in a helper column, then check that COUNT now returns 50.