How to calculate an average in Excel: blanks, zeros, conditions and weighted averages
It's one function, yet averages go wrong all the time. See how AVERAGE works, what it skips, and how to average without zeros, with a condition or with weights, on real spreadsheets.
Christophe, founder of Lurndo
· 11 min read
To calculate an average in Excel, use the AVERAGE function, as in =AVERAGE(B2:B9): Excel adds up the numbers and divides by how many numbers there are. It skips blank cells, text and TRUE or FALSE in the range, but a 0 counts. Use AVERAGEIF to leave out zeros or to average only what meets a condition. For a weighted average, divide the sum of the products by the sum of the weights.

How do you calculate an average in Excel?
Type =AVERAGE( in an empty cell, select the cells with your numbers, close the bracket and press Enter. Excel adds up the numbers and divides by how many there are, so the average of 4, 8 and 9 is 21 divided by 3, which is 7. You can skip the typing, too: click below your column, then on the Home tab click the arrow next to AutoSum and pick Average (Microsoft).
=AVERAGE(B2:B9)It's hardly an obscure function. In 2019 Microsoft called SUM and AVERAGE the two most used functions in Excel (Microsoft). Yet averages still go wrong, because a blank cell, a 0 and a number stored as text all count differently. Below you'll see how, on real sheets from our Excel course. Want to practise the basics first? Start with the lesson working out the average with AVERAGE.
How does the AVERAGE function work?
=AVERAGE(number1, [number2], ...)Only number1 is required: the first number, cell or range. After that you can add more, up to a maximum of 255 according to Microsoft (Microsoft), and each argument can be a whole range. =AVERAGE(D2:D11,F2:F11) takes two columns together, and =AVERAGE(D2:E11) a block two columns wide. So it works across rows and columns alike, just like SUM.
Most English-language help separates the arguments with commas, but that comes from your settings, not from Excel itself or from Windows versus Mac. According to Microsoft, the list separator depends on the regional settings of your operating system and of Excel (Microsoft). Where the comma is the decimal mark, as in much of mainland Europe, you'll see =AVERAGE(D2:D11;F2:F11) instead.
How do you average a column in Excel?
Take the whole column as the range, blank cells included: AVERAGE skips what's blank by itself. Here's an example. Ruth, the chair of the Green Fingers allotments in Harrogate, weighs the harvest of ten plots every year. Green Fingers is the second client in our Excel course. Column D holds the kilos of tomatoes. Plot P04 is vacant and Luke grew no tomatoes on P09, so those two cells are blank.
| Row | A: Plot | B: Tenant | D: Tomatoes (kg) |
|---|---|---|---|
| 2 | P01 | Molly | 18.4 |
| 3 | P02 | Karim | 7.9 |
| 4 | P03 | Annabel | 21.6 |
| 5 | P04 | (blank) | |
| 6 | P05 | Will | 30.2 |
| 7 | P06 | Sophie | 6.5 |
| 8 | P07 | Ben | 15.7 |
| 9 | P08 | Fatima | 27.9 |
| 10 | P09 | Luke | (blank) |
| 11 | P10 | Jodie | 19.3 |
=AVERAGE(D2:D11)The formula returns 18.4375, which Excel shows as 18.44 kg in a column formatted to two decimals. That's 147.5 kg divided by 8, not by 10: AVERAGE skips the two blank cells. Work it out yourself with =SUM(D2:D11)/10 and you get 14.75 kg, as if P04 and P09 each grew 0 kg of tomatoes. But a plot without tomatoes didn't have a bad tomato harvest. It simply didn't have one.
Now try it yourself, on the real Green Fingers sheet, with the courgettes and beans as well. One formula is enough. Fill it to the right and the range moves along to the next column, and AVERAGE skips the blank cells in each column on its own.
Try it: the average harvest per crop
In D12, work out the average kilos of tomatoes per plot, then fill the formula right to F12 for the courgettes and the beans.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Plot | Tenant | m² | Tomatoes (kg) | Courgettes (kg) | Beans (kg) |
| 2 | P01 | Molly | 50 | 18.40 | 9.20 | 4.50 |
| 3 | P02 | Karim | 25 | 7.90 | 2.10 | |
| 4 | P03 | Annabel | 50 | 21.60 | 12.80 | 6.30 |
| 5 | P04 | 25 | ||||
| 6 | P05 | Will | 75 | 30.20 | 15.50 | 8.80 |
| 7 | P06 | Sophie | 25 | 6.50 | 4.10 | |
| 8 | P07 | Ben | 50 | 15.70 | 10.30 | 5.20 |
| 9 | P08 | Fatima | 75 | 27.90 | 18.60 | 9.40 |
| 10 | P09 | Luke | 25 | 3.80 | 1.90 | |
| 11 | P10 | Jodie | 50 | 19.30 | 11.10 | 5.70 |
| 12 | Average | |||||
| 13 | Highest | |||||
| 14 |
Your formula ran in your own browser, and we then checked it on a second, hidden version of the sheet with different harvests. Type 18.44 instead of a formula, or divide by 10 yourself, and it might pass here but it gets caught there.
Does AVERAGE count blank cells, zeros and text?
Blank cells no, zeros yes, text no. Microsoft says that if a range contains text, logical values or empty cells, AVERAGE ignores them, while cells with the value zero are included (Microsoft). You can see the difference clearly on the member list of The Splash swimming pool in Tamworth, the third client in the course.
| Row | A: Name | B: Age | D: Visits |
|---|---|---|---|
| 2 | Jack | 9 | 3 |
| 3 | Nora | 34 | 22 |
| 4 | Mila | 15 | 9 |
| 5 | Rita | 67 | 15 |
| 6 | Laura | 41 | (blank) |
| 7 | Rory | 7 | 6 |
| 8 | Jim | 72 | 18 |
| 9 | Will | 28 | 4 |
| 10 | Hannah | 12 (as text) | 11 |
| 11 | Sara | 55 | 0 |
=AVERAGE(D2:D11) returns 9.78 visits: 88 divided by 9. Nothing's filled in for Laura, so she isn't counted. Sara never came, and that 0 does count. That's right, too: Sara has an annual pass and really didn't come. But if someone types a 0 for Laura because they don't know, the average drops to 8.8, even though nobody came less often.
For the ages, =AVERAGE(B2:B11) returns 36.44 years: 328 divided by 9. Hannah's 12 is stored as text, so it's skipped without any warning. As a number, the average would be 34. Not sure? Compare =COUNT(B2:B11) with =COUNTA(B2:B11): 9 numbers against 10 filled cells. You'll practise how COUNT works in the lesson counting with COUNT.
A zero you can't see still counts. Turn off "Show a zero in cells that have a zero value" in Excel's options and a cell holding 0 looks blank, but AVERAGE still includes it (Microsoft).
How do you average without zeros, or with a condition?
With AVERAGEIF, which averages only the numbers that meet a condition. Microsoft gives the no-zeros example itself, using "<>0", not equal to zero, as the criteria (Microsoft). At The Splash that returns 11 visits, 88 divided by 8, leaving out Sara and Laura's blank cell. Only use it when those zeros really shouldn't count.
=AVERAGEIF(D2:D11,"<>0")AVERAGEIF takes three arguments: the range to test, the criteria, and the range to average. Leave out the third and Excel averages the first range (Microsoft). With all three, the Second Chance charity shop in Gloucester, the fourth client in the course, works out what an item of clothing fetched on average this week.
| Row | A: Item | B: Category | C: Price (£) |
|---|---|---|---|
| 2 | Dress green | Clothing | 12 |
| 3 | Book fiction | Books | 2 |
| 4 | Lamp | Household | 8 |
| 5 | T-shirt S | Clothing | 3 |
| 6 | Dressing gown | Clothing | 6 |
| 7 | Puzzle | Toys | 4 |
| 8 | Book cooking | Books | 3 |
| 9 | Radio | Electrical | 15 |
| 10 | T-shirt XL | Clothing | 4 |
| 11 | Dress black | Clothing | 18 |
| 12 | What? Game | Toys | 5 |
| 13 | Vase | Household | 7 |
| 14 | T-shirt M | Clothing | 3 |
| 15 | Bookend | Household | 9 |
| 16 | Kids' bike | Toys | 35 |
=AVERAGEIF(B2:B16,"Clothing",C2:C16)
=AVERAGEIFS(C2:C16,B2:B16,"Clothing",C2:C16,">5")The first formula returns £7.67: six items of clothing that fetched £46 together. For more than one condition you use AVERAGEIFS, and there the range to average comes first (Microsoft). The second formula returns £12, the average of the clothing over £5. You write the same criteria when adding up with SUMIF and counting with COUNTIF. Your turn now, with the toys.
Try it: what do toys cost on average?
What did a toy sell for on average this week? Work it out in I2.
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Item | Category | Price | Day | Volunteer | Limit | ||||
| 2 | Dress green | Clothing | £12.00 | Mon | Sophie | £10.00 | ||||
| 3 | Book fiction | Books | £2.00 | Mon | Omar | |||||
| 4 | Lamp | Household | £8.00 | Tue | Sophie | |||||
| 5 | T-shirt S | Clothing | £3.00 | Tue | Grace | |||||
| 6 | Dressing gown | Clothing | £6.00 | Wed | Omar | |||||
| 7 | Puzzle | Toys | £4.00 | Wed | Grace | |||||
| 8 | Book cooking | Books | £3.00 | Thu | Sophie | |||||
| 9 | Radio | Electrical | £15.00 | Thu | Omar | |||||
| 10 | T-shirt XL | Clothing | £4.00 | Fri | Sophie | |||||
| 11 | Dress black | Clothing | £18.00 | Fri | Grace | |||||
| 12 | What? Game | Toys | £5.00 | Sat | Omar | |||||
| 13 | Vase | Household | £7.00 | Sat | Grace | |||||
| 14 | T-shirt M | Clothing | £3.00 | Sat | Sophie | |||||
| 15 | Bookend | Household | £9.00 | Sat | Omar | |||||
| 16 | Kids' bike | Toys | £35.00 | Sat | Grace | |||||
| 17 |
Average or median: which should you use?
Use the median when a few outliers skew your average. The median is the middle number once everything's sorted, and an outlier barely moves it. At Second Chance an item sold for £8.93 on average, yet ten of the fifteen items cost less than that. The £35 kids' bike pulls the average up.
=AVERAGE(C2:C16)
=MEDIAN(C2:C16)The median is £6: seven items cost less and seven cost more. Leave the bike out and the average drops to £7.07, while the median only moves to £5.50, because with an even number of values MEDIAN averages the two in the middle. According to Microsoft, the average and the median are the same when the numbers are symmetrically distributed, and can differ when the distribution is skewed (Microsoft).
Which one you report depends on your question. If you want to know what a week brings in, you need the average, because average times count is the total. If you want to know what a typical item costs, the median says more. When in doubt, work out both: if they're far apart, there's an outlier in your data.
How do you calculate a weighted average in Excel?
Multiply each value by its weight, add up those products and divide by the sum of the weights. AVERAGE gives every number the same weight, and that isn't always what you're after. Take a Saturday evening at The Golden Chip in Whitby, the first client in the course.
| Row | A: Product | B: Price (£) | C: Quantity |
|---|---|---|---|
| 2 | Small chips | 2.80 | 64 |
| 3 | Large chips | 3.60 | 41 |
| 4 | Battered sausage | 4.50 | 27 |
| 5 | Fish cake | 3.90 | 35 |
| 6 | Curry sauce | 2.20 | 52 |
| 7 | Mushy peas | 0.80 | 70 |
| 8 | Cola | 2.50 | 48 |
| 9 | Water | 2.00 | 22 |
=AVERAGE(B2:B9) returns £2.79, the average price on the menu. But what did a customer pay on average per item sold? Then every price should count as often as it went over the counter, so the mushy peas, sold 70 times, weigh more than the water, which sold 22 times.
=SUM(B2:B9*C2:C9)/SUM(C2:C9)That returns £2.56: £919.20 in sales divided by 359 items sold. In Microsoft 365 you simply confirm the formula with Enter. In older versions it's a legacy array formula, which you confirm with Ctrl+Shift+Enter (Microsoft). Many people use SUMPRODUCT instead, as Microsoft does in its own weighted-average example (Microsoft): =SUMPRODUCT(B2:B9,C2:C9)/SUM(C2:C9).
Want to see every step? Use a helper column. Put =B2*C2 in D2, fill it down to D9 and divide with =SUM(D2:D9)/SUM(C2:C9). That works in every version, and you can see at a glance which product brought in the most: the small chips, with £179.20.
How do you round an average?
With ROUND: =ROUND(AVERAGE(D2:D11),1) turns the 18.4375 kg of tomatoes into a real 18.4. Showing fewer decimals with the formatting buttons is something else. The cell then looks rounded, but every formula that refers to it keeps calculating with 18.4375. The second argument is the number of decimal places, and 0 gives you whole kilos. You'll practise the difference in the lesson rounding with ROUND.
Why does AVERAGE return #DIV/0!?
Because there's nothing to average. An average is a sum divided by a count, and without a single number you're dividing by zero. Excel shows #DIV/0! when a number is divided by zero (Microsoft). With AVERAGE that happens when the range is empty or holds only text. AVERAGEIF also returns it when no cell meets the criteria (Microsoft).
Second Chance sold no furniture this week, so =AVERAGEIF(B2:B16,"Furniture",C2:C16) returns #DIV/0!. That's actually an honest answer: there's no average. If you'd still rather see some text on the sheet, say for a report you print, catch that one case with IF and COUNTIF:
=IF(COUNTIF(B2:B16,"Furniture")=0,"No sales",AVERAGEIF(B2:B16,"Furniture",C2:C16))IFERROR is shorter, but Microsoft warns that it suppresses all errors, not just #DIV/0! (Microsoft). A typo in the formula would vanish too. With IF you only catch the case where there's nothing to average. You'll find how IF chooses between two results in the IF function explained.
Why is my Excel average wrong?
Usually AVERAGE calculates exactly what you ask, but the range holds something other than you think. You won't get an error message either: the number looks believable and is still wrong. Run through these four causes before you send it on:
- A 0 where nothing belongs. Leave an unknown value blank. If someone types a 0 for Laura, the average at The Splash drops from 9.78 to 8.8 visits.
- Numbers stored as text. AVERAGE skips them without a warning, like Hannah's age. Select the cells, click the alert button that appears beside them and choose Convert to Number (Microsoft).
- Hidden rows. AVERAGE uses every cell in the range, including rows you've hidden or filtered out. For only what's visible, use
=SUBTOTAL(101,D2:D11). With 101, SUBTOTAL also skips rows hidden with the Hide Rows command, and it always leaves out rows a filter hides (Microsoft). - An average of averages. At Second Chance, clothing averaged £7.67, books £2.50, household £8, toys £14.67 and electrical £15. The average of those five is £9.57, while an item sold for £8.93 on average: the single radio weighs as much as six items of clothing. Average the original numbers instead.
Which functions go with AVERAGE?
| Function | What it returns |
|---|---|
| AVERAGE | The average of all the numbers |
| AVERAGEIF | The average of what meets one condition |
| AVERAGEIFS | The average with several conditions |
| MEDIAN | The middle number |
| MIN and MAX | The smallest and the largest number |
| COUNT | How many numbers there are |
| ROUND | A number that's really rounded |
| SUBTOTAL | With 101, the average of what's visible |
| SUMPRODUCT | The sum of products, for a weighted average |
You'll find the best and the worst harvest at Green Fingers with MIN and MAX, in the lesson the biggest and the smallest. And if you want to know the other formulas you'll use every week, read 12 basic Excel formulas everyone should know.
Averaging is the first lesson of module 2 in our Excel course, at Green Fingers. You calculate on real sheets, with the function names and separator of your own Excel, and every formula is checked on its result. The first three modules are free.
Frequently asked questions
How do I calculate an average in Excel without zeros?
Use AVERAGEIF with "<>0" as the criteria, as in =AVERAGEIF(D2:D11,"<>0"). It averages only the numbers that aren't zero, and blank cells were already skipped by AVERAGE. Check first whether those zeros really should go, though: a zero that's true belongs in the average, and leaving it out makes the result look better than it is.
Does AVERAGE ignore blank cells in Excel?
Yes. AVERAGE skips blank cells, and text and TRUE or FALSE in a range too. A cell holding 0 does count. That's why =SUM(D2:D11)/10 isn't the same as =AVERAGE(D2:D11) as soon as the range has blank cells. So leave an unknown value blank instead of typing a 0 into it.
What's the difference between average and median in Excel?
The average is the sum divided by how many numbers there are. The median is the middle number once you sort them. A single outlier, such as a £35 bike among items of a few pounds, pulls the average up and barely moves the median. If the two are far apart, look for outliers.
How do you calculate a weighted average in Excel?
Multiply each value by its weight, add up the products and divide by the sum of the weights, as in =SUM(B2:B9*C2:C9)/SUM(C2:C9). In older versions of Excel you confirm that formula with Ctrl+Shift+Enter. Many people use SUMPRODUCT instead, or a helper column with the products, which works in every version.
Why does my average show #DIV/0!?
Because there's no number to average, so Excel ends up dividing by zero. It happens when the range is empty or holds only text, or, with AVERAGEIF, when no cell meets the criteria. Catch that case with IF and COUNTIF, or with IFERROR once you're sure the rest of the formula works.
Practise this in the course
Every lesson explains first and then lets you practise yourself, with a real spreadsheet in your browser.
- AVERAGEFunctions and references · The average
- AVERAGEIFCounting and adding with conditions · An average with a condition
- ROUNDFunctions and references · Rounding
- COUNTFunctions and references · Counting what's there
Sources
- Microsoft Support, AVERAGE function
- Microsoft Support, Calculate the average of a group of numbers
- Microsoft Support, AVERAGEIF function
- Microsoft Support, AVERAGEIFS function
- Microsoft Support, MEDIAN function
- Microsoft Support, SUBTOTAL function
- Microsoft Support, Guidelines and examples of array formulas
- Microsoft Support, How to correct a #DIV/0! error
- Microsoft Support, Convert numbers stored as text to numbers
- Microsoft Support, How to avoid broken formulas in Excel
- Microsoft Tech Community, Announcing XLOOKUP (2019-08-28)
Christophe, founder of Lurndo
Christophe builds Lurndo from Belgium, with short, playful exercises for SQL, Excel, HTML & CSS and touch typing that show straight away what your answer does. On this blog, Christophe answers the questions people run into while learning, with sources you can check yourself.
Read next
COUNTIF examples: how to count text, numbers, blanks and duplicates in ExcelOne function, two arguments, and it still miscounts more often than you'd think. On a charity shop's sheet you'll see every kind of criterion at work, and you'll type the formula yourself.Excel · · 12 min read
Excel IF function examples: text, AND, OR, nested IF and IFSOne test, two outcomes and a handful of traps. On a swimming pool's members sheet you'll see IF at work, from a simple choice to three categories, and you'll try it yourself right away.Excel · · 12 min read