Averaging over cells with a number (including a zero) but not empty cells

erik11

New Member
Joined
Apr 30, 2011
Messages
11
Dear MrExcel users

I have a problem, that I hope someone can help me solve:
How do I write a formula in a cell, which will compute the average of all the numbers in the range from say A1 to A5 in the following way: If any of the cells in the range are empty they should be left out completely. So in the following example, the "advanced average" I am looking for should deliver the result (3+7+0+10)/4 = 5:

3
7
0
(empty)
10

NB! My intention is a worksheet, which can calculate the "current average" as the cells are being filled out ...

Regards, Erik
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hello. AVERAGE ignores blank cells and text entries so you can use

=AVERAGE(A1:A5)
 
Upvote 0
Dear MrExcel users

I have a problem, that I hope someone can help me solve:
How do I write a formula in a cell, which will compute the average of all the numbers in the range from say A1 to A5 in the following way: If any of the cells in the range are empty they should be left out completely. So in the following example, the "advanced average" I am looking for should deliver the result (3+7+0+10)/4 = 5:

3
7
0
(empty)
10

NB! My intention is a worksheet, which can calculate the "current average" as the cells are being filled out ...

Regards, Erik
Use the AVERAGE function. It will ignore empty cells (unless all the cells are empty!).

=AVERAGE(A1:A5)

If all the cells are empty then you'd get a #DIV/0! error.

One way to account for that is to make sure there is at least one number in the range:

=IF(COUNT(A1:A5),AVERAGE(A1:A5),"")
 
Upvote 0
Great Biff! That was exactly what I was looking for, so I avoid the division by zero. Thanks a lot!

Erik
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top