Getting an average from multiple cells excluding "0"/Zeros, Microsoft Excel 2010

HBsOnly

New Member
Joined
May 24, 2013
Messages
7
Hey how's everyone doing? First time on this forum, I normally resist the urge to go on a forum and try to figure things out myself, but this time I just don't have a clue whats going wrong. Hopefully you guys and gals can help.

I am trying to calculate the average of the following cells for a template I am creating.

B23,B42,B62,B81 and B107 (all of these cells contain the =sum function)

However I know sometimes on certain weeks one or two of these particular cells will not see any activity and the sum will equal "0" zero.

So on a normal week
B23+B42+B62+B81+B107/5 = Average

I want a function where if lets say B23 = 0 it is automatically excluded from the calculation so it would look like this:
B42+B62+B81+B107/4 = Average

I tried plugging this function in:

=SUM(B23,B42,B62,B81,B107)/INDEX(FREQUENCY((B23,B42,B62,B81,B107),{0}),2)

Excel gives me : #DIV/0!

Then I tried,

=IF(INDEX(FREQUENCY(B23,B42,B62,B81,B107),{0}),2),SUM(B23,B42,B62,B81,B107)/INDEX(FREQUENCY((B23,B42,B62,B81,B107),{0}),2),"")

Excel tells me : You've entered too many arguments for this function.


Would greatly appreciate it if someone could help thanks.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try:
Code:
=IFERROR(SUM(B23,B42,B62,B81,B107)/(5-SUMPRODUCT((B23=0)+(B42=0)+(B62=0)+(B81=0)+(B107=0))),"All are 0")
 
Upvote 0
how about this:

=AVERAGEA(B23,B42,B62,B81,B107)

Edit: never mind, this only works if one is actually missing, not when it's 0
 
Last edited:
Upvote 0
Welcome to the forum.

Try this:
=SUM(B23,B42,B62,B81,B107)/(COUNT(B23,B42,B62,B81,B107)-FREQUENCY((B23,B42,B62,B81,B107),{0}))
 
Upvote 0
Averagea includes the zero cell. If 2 of the 5 values are zero they want to divide by 3 not 5.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

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