A wee bit of difficulty with Count Function

Saffire

New Member
Joined
Mar 12, 2012
Messages
14
Hey everyone,

This is going to probably be one of those "D'OH!" questions but here I go.

I have a range (C2:C32) that has some zero values. I need to average the range WITHOUT the zeros. I believe that a counting function would work, but of course I am having one of those blonde moments that I am notorious for.

Here is the formula that I was originally trying:
=COUNT(C2:C32>0)AVERAGE(C2:C32)

Of course, my excel sheet called me some very bad names when I entered that!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hey everyone,

This is going to probably be one of those "D'OH!" questions but here I go.

I have a range (C2:C32) that has some zero values. I need to average the range WITHOUT the zeros. I believe that a counting function would work, but of course I am having one of those blonde moments that I am notorious for.

Here is the formula that I was originally trying:
=COUNT(C2:C32>0)AVERAGE(C2:C32)

Of course, my excel sheet called me some very bad names when I entered that!
Try one of these...

If you're using Excel 2007 or later:

=AVERAGEIF(C2:C32,"<>0")

This array formula** will work in all versions of Excel:

=AVERAGE(IF(C2:C32<>0,C2:C32))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0
All versions:
=AVERAGE(IF(C2:C32<>0,C2:C32))

Press ctrl+shift+enter, not just enter


Excel 2007 and higher:
=AVERAGEIF(C2:C32,"<>0",C2:C32)

Just enter normally
 
Upvote 0
Those all work very well, thank you. Just a teensy little thing ... how would I get it to display 0 instead of #DIV/0 ... probably something so easy a kindergartner could do it, I'm sure. Thanks for all the help!
 
Upvote 0
Those all work very well, thank you. Just a teensy little thing ... how would I get it to display 0 instead of #DIV/0 ... probably something so easy a kindergartner could do it, I'm sure. Thanks for all the help!
What version of Excel are you using?
 
Upvote 0
Yes, I am using Office 2007 and you are a total lifesaver! Bossman didn't believe me when I told him we would not have to do all those calculations by hand. I love the 'fossil fuels', sometimes I wonder how they managed without Excel ... let alone without computers :D
 
Upvote 0
Yes, I am using Office 2007 and you are a total lifesaver! Bossman didn't believe me when I told him we would not have to do all those calculations by hand. I love the 'fossil fuels', sometimes I wonder how they managed without Excel ... let alone without computers :D
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0
Okay, ran into another SNAFU on this subject. Everything works perfectly for me in Excel 2007, however Bossman refuses to let go of his Excel 2003 stating that he has "just now gotten use to it"! I need to revise this formula to work in 2003 without getting back a #DIV/0 result. Any ideas?

I have been using the array:

{=AVERAGE(IF(J2:J32<>0,J2:J32,"0"))}
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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