Sub topic 6
Counting numbers with COUNT
This chapter assumes you can enter values in cells, select ranges, and start a formula with =. It also assumes you have seen SUM and AVERAGE. COUNT is the simplest of the five core functions, but it is the one that explains how the others treat your data.
What COUNT returns
COUNT returns how many values in its arguments are numbers. It does not add them and does not look at their size. It only checks whether each value is a number.
=COUNT(B2:B6)Suppose B2:B6 holds this data:
| Cell | Content | Counted by COUNT? |
|---|---|---|
| B2 | 120 | Yes |
| B3 | 85 | Yes |
| B4 | (empty) | No |
| B5 | n/a (text) | No |
| B6 | 0 | Yes |
The formula returns 3. The zero counts because it is a real number. The empty cell and the text do not.
What Excel treats as a number
Excel stores several kinds of values as numbers, so COUNT counts all of them:
- Ordinary numbers, including negatives, zeros, decimals, and percentages.
- Dates. Excel stores a date as a serial number, so
COUNTcounts date cells. - Times, which are stored as fractions of a day.
- Results of formulas that return a number.
COUNT skips these:
- Empty cells.
- Text, including text that looks like a number, such as
"123"stored as text. - Logical values (
TRUEandFALSE) that sit in a cell or range. - Error values such as
#N/Aor#DIV/0!in a cell or range. - Formulas that return an empty string (
""). The cell looks blank, but it contains text.
=COUNT(C2:C6)If C2:C6 holds five dates, this returns 5, even though the cells display as dates and not as numbers.
How COUNT decides
The diagram shows the check COUNT applies to each value in a range.
Errors do not spread through COUNT
Most functions in this tutorial return an error if the range contains one. SUM(B2:B6) returns #N/A if any cell in B2:B6 is #N/A. COUNT does not. It treats the error cell as a non-number and moves on.
=COUNT(B2:B6)If B3 is #N/A and the other four cells are numbers, this returns 4. That makes COUNT useful for checking how many valid numbers exist before you run a function that would fail.
Direct arguments follow different rules
When you type a value straight into the formula instead of referencing a cell, Excel converts it first:
=COUNT(1, "2", TRUE, "x")This returns 3:
1is a number, so it counts."2"is text that Excel can convert to a number, so it counts.TRUEtyped directly is converted to 1, so it counts."x"cannot be converted, so it does not count.
The same "2" or TRUE inside a cell in a range would not count. This difference between direct arguments and references causes confusing results when you copy a test formula into a real worksheet. Excel applies the stricter rule to references because data in cells is assumed to be what it appears to be.
Using more than one argument
Like SUM, COUNT accepts several arguments, up to 255. Each can be a range, a single cell, or a constant.
=COUNT(B2:B6, D2:D6, 100)This counts the numbers in both ranges and adds 1 for the constant 100. If B2:B6 contains 3 numbers and D2:D6 contains 4, the result is 3 + 4 + 1 = 8.
Overlapping ranges are counted twice. =COUNT(B2:B6, B4:B8) counts the cells B4:B6 once for each argument. Keep ranges separate unless you want that.
A whole-column reference works too:
=COUNT(B:B)This counts every number in column B. It keeps working as you add rows. Make sure the column does not contain a title row with a number, such as a year used as a header, or a total row that contains a number. Both would be counted.
Counting is how you check your data
You can use COUNT next to other functions to confirm they are working on the data you expect.
Compare with the number of rows
=COUNT(B2:B6)
=ROWS(B2:B6)If the first result is smaller than the second, some cells in the range are not numbers. The next section shows how to find out how many and why.
Find numbers stored as text
A common problem is data imported from another system, where numbers arrive as text. SUM and AVERAGE quietly ignore them. COUNT ignores them too, but you can use the difference between COUNT and COUNTA to see the gap:
=COUNTA(B2:B6) - COUNT(B2:B6)COUNTA counts every non-empty cell. Subtracting COUNT leaves the number of cells that contain something other than a number. If that count is not zero, inspect the cells. Excel often marks text-numbers with a green triangle in the corner of the cell. Typical fixes are:
- Select the cells and use the warning icon's Convert to Number option.
- Use Text to Columns on the column and finish with the default settings.
- Use a helper column such as
=VALUE(B2), or=--B2, and point your summary at the helper column.
Why this matters for AVERAGE
AVERAGE(B2:B6) is the sum of the numbers divided by the count of the numbers. It gives the same result as this:
=SUM(B2:B6)/COUNT(B2:B6)If three of five cells are text-numbers, the average is computed over only two values, and Excel shows no warning. Comparing COUNT to the row count catches this before you report the result.
Measure completeness
You can turn the count into a percentage of how much of a range is filled with numbers:
=COUNT(B2:B6)/ROWS(B2:B6)Format the cell as a percentage. With 3 numbers in 5 rows, this shows 60%.
Guarding against an empty range
COUNT returns 0 when there are no numbers. It never returns an error for an empty range, which makes it a safe test:
=IF(COUNT(B2:B6)=0, "No data", AVERAGE(B2:B6))Without the test, AVERAGE would divide by zero and return #DIV/0!. The test runs first and returns the message instead.
When COUNT is not the right tool
| You want to count | Use |
|---|---|
| Numbers, dates, and times | `COUNT` |
| Every non-empty cell, including text | `COUNTA` |
| Empty cells | `COUNTBLANK` |
| Numbers that meet a condition, such as over 100 | `COUNTIF` |
| Numbers in visible rows only | `SUBTOTAL(102, range)` |
COUNT has no condition argument. To count only values above 100, use =COUNTIF(B2:B6, ">100"). Later chapters cover COUNTIF and SUBTOTAL. Note that COUNT includes rows hidden by a filter, so a filtered list still shows the full count.
Common mistakes
- Expecting text to count. A column of names returns 0. Use
COUNTAfor that. - Expecting formulas that return
""to count as blank.COUNTskips them because they are text, andCOUNTAcounts them because the cell is not empty. - Counting a header or total row. A year in a header, or a total in the last row, adds 1 each. Check the range edges.
- Trusting a count that looks right. A count of 5 over 5 rows can still include dates or ID numbers you did not mean to count. Look at the data once.
- Forgetting that zero is a number. A cell with 0 is counted. An empty cell is not. If your data uses 0 to mean "missing",
COUNTandAVERAGEwill both include it.
Exercise
B2:B7 contains these entries: 40, "15" (typed as text, left-aligned), TRUE, an empty cell, #N/A, and the date 2026-03-01. What does =COUNT(B2:B7) return, and what does =COUNTA(B2:B7) - COUNT(B2:B7) return?
Show answer
COUNT returns 2: the number 40 and the date, which Excel stores as a number. The text "15", the logical TRUE, the error #N/A, and the empty cell are all skipped. COUNTA counts every non-empty cell, which is 5 (40, "15", TRUE, #N/A, the date). So the subtraction is 5 - 2 = 3, the number of non-empty cells that COUNT did not treat as numbers.
Exercise
Write one formula that returns the average of B2:B20 when it contains at least one number, and the text "Check data" when it contains none. Explain why COUNT is a better test than counting blank cells.
Show answer
=IF(COUNT(B2:B20)=0, "Check data", AVERAGE(B2:B20)). AVERAGE only fails when there are no numeric cells. A range with no blank cells can still hold only text or errors, so a blank-cell test would miss it. COUNT checks exactly the condition that makes AVERAGE return #DIV/0!.