Average result getting skewed by zero's

mykeee

New Member
Joined
Sep 9, 2010
Messages
46
I am working on a spreadsheet where I need to determine the average of 12 cells.

=AVERAGE(E19:E30)

The contents of these 12 cells (worksheet A) are pulled from another worksheet (B), and if worksheet B does not have data in each of the 12 cells, the blank cells display a zero in the corresponding cell of worksheet A.

This poses a problem for the formula above as it averages 12 data points regardless of how many data points are entered into worksheet B. If there are only 6 data points, I need the average of the 6 data points, not 6 data points plus 6 zeros.

Anyone have ideas on how to resolve this?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Can you change your formula to return "" if the source cells are blank? Null values will be ignored by the AVERAGE function.
 
Upvote 0
What version of Excel are you using?
Excel 2007+
=AVERAGEIF(E19:E30,"<>0",E19:E30)
Excel 2003 -
=SUM(E19:E30)/COUNTIF(E19:A30,"<>0")
 
Upvote 0
In Excel 2007 or later

=AVERAGEIF(E19:E30,">0")

in earlier versions

=SUM(E19:E30)/COUNTIF(E19:E30,">0")



Sorry, I should have told you I am using Excel 2003.

I tried the =SUM(E19:E30)/COUNTIF(E19:E30,">0") and it appears to work... However, I just realized something that complicates this a bit. What if the data truly is zero? In some cases it may be a valid result. I don't want those results to be ignored.
 
Upvote 0
=IF(ISBLANK(Data!E19),"",Data!E19)
Edit: Please use Andrew Poulsom's formula for its better argument for numbers!
 
Last edited:
Upvote 0
Try:

=IF(ISNUMBER(Data!E19),Data!E19,"")



Works great Andrew! Thanks!

I have another question now that stemmed from fixing this problem.

I had conditional formatting on the cells E19 to E30 that turns the cell background red if either of the two conditions are met:

Formula Is : =ISTEXT(E19)

Cell Value Is: Greater Than 10

Now this was working prior to this latest fix, however, now if I have a null value returned to one of those cells it turns red even though it is neither text or greater than 10.

Any ideas what's going on here?
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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