Excel Lessons

AVERAGE in Excel: what happens to blanks, zeros and text

AVERAGE skips empty cells and text but counts zeros, so the same data can give two answers. When each is right, and how to average without the zeros.

Published . 5 min read.

By Ali, Founder, Excel Lessons

AVERAGE in Excel skips empty cells and text, but it counts zeros. So a 0 pulls the average down, and an empty cell does not. The same list can give two different answers, depending on what you typed for "nothing".

The collection tins

A charity puts collection tins in 8 places in a town. At the end of the week, a volunteer types what each tin held.

Row A B
1 TinAmount
2 Library42
3 Bakery0
4 Gym35
5 School
6 Market58
7 StationLost
8 Church0
9 Office33

Each odd cell means something different. The Bakery and Church tins came back empty, so 0 is true. The School tin has not been collected yet, so B5 is empty. The Station tin was lost, and somebody typed a word.

Four averages from the same 8 cells

The amounts add up to 168. Each formula divides that by a different count.

FormulaResultDivides 168 by
=AVERAGE(B2:B9)286 numbers
=AVERAGEIF(B2:B9,"<>0")424 numbers that are not 0
=AVERAGEA(B2:B9)247 cells that are not empty
=SUM(B2:B9)/ROWS(B2:B9)21all 8 rows
  • AVERAGE counts the 2 zeros. It skips the empty School cell and the word Lost.
  • AVERAGEIF with "<>0" also leaves out the zeros. It averages only the tins that held money.
  • AVERAGEA counts the word Lost as 0. It still skips the empty cell. Many people expect it to count empty cells, and it does not.
  • SUM divided by ROWS counts every row. That includes the tin that is not in yet.

Which one is right?

It depends on the question. "How much does a collected tin hold?" is 28. The empty tins were collected, so they count. The School tin is not in yet, so it should not count.

"How much does a tin hold when people give?" is 42. That is a fair number to quote, as long as you say that 2 tins held nothing.

Use AVERAGE, and make the cells say what you mean. Leave a cell empty when there is no number yet. Type 0 only when the answer really is 0. Use AVERAGEIF with "<>0" when a 0 means "no data" and you cannot change the sheet.

The placeholder zero

This is the mistake in real files. Somebody types 0 in B5 to mean "not collected yet". AVERAGE now counts it, and the average falls from 28 to 24. Nothing on the sheet looks wrong.

Next week the School tin comes in with 50. Somebody types over the 0, and the numbers are right again. But any report made in between used the wrong average.

Do not remove zeros with COUNTIF

Some people write the average without zeros by hand: =SUM(B2:B9)/COUNTIF(B2:B9,"<>0"). It gives 28, not 42.

COUNTIF with "<>0" counts every cell that is not 0. That includes the empty cell and the word Lost, so it counts 6 cells. Use AVERAGEIF, which only averages numbers. Or use =SUM(B2:B9)/COUNTIF(B2:B9,">0"), which gives 42.

Zeros and numbers you cannot see

A zero that looks empty. Some files hide zeros. The option is under File, Options, Advanced: "Show a zero in cells that have zero value". A custom number format can hide them too. The cell looks empty, but AVERAGE still counts the 0.

A zero that looks like a dash. The Accounting format shows 0 as a dash. It is still a 0, and it still counts.

A number stored as text. Say 58 in B6 came from an export as text. AVERAGE skips it, as it skips Lost. The average falls to 22. See numbers stored as text for the fix.

Check what AVERAGE can see

Before you trust an average, count what is in the range. On the tins sheet:

  • =COUNT(B2:B9) gives 6. These are the numbers AVERAGE uses.
  • =COUNTIF(B2:B9,0) gives 2. These are the zeros inside those 6.
  • =COUNTA(B2:B9) gives 7. That is every cell that is not empty.
  • =COUNTBLANK(B2:B9) gives 1. That is the School tin.

If COUNT is smaller than you expect, a cell holds text. If COUNTIF finds zeros, ask what each one means. The COUNT, COUNTA and COUNTBLANK article has more on these.

Two errors you will meet

#DIV/0! means the range has no numbers at all. An average of nothing cannot be worked out. AVERAGEIF gives the same error when no cell meets the condition.

Any other error in the range spreads. If one cell shows #N/A, AVERAGE shows #N/A too. Fix the cell that has the error, not the average.

When one tin holds far more than the rest, the average stops being typical. That is a different problem, covered in average vs median. The lessons below practise AVERAGE and AVERAGEIF. Each lesson is a real sheet you type into, and each answer is checked when you press Enter.

Related articles