Ignore Zeros in Aggregate Average Function

WilliamPHII

New Member
Joined
Aug 30, 2018
Messages
20
I get a feeling this might not be possible, but I have a table that uses the Aggregate function to average a column. It needs to be Aggregate, because that allows me to use slicers to see averages for different items in my table. The problem is, the Aggregate average is averaging the zeros and throwing it off. Is there anyway to prevent this?

If I were averaging the whole range, I'm aware I could be using AverageIf. The problem here is that I want a function that ignores hidden rows so it works with slicers.

Any brilliant ideas out there?

Thanks.

William
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
How are the zeroes entered in the table? Also do other formulas exist that need the zeroes to be there?
 
Upvote 0
I think you're right we could do something about how the zeros get there... I simply wanted to pose the question that IF the zeros ARE there, is there any way to avoid them in a slice-able way?
 
Upvote 0
Not sure I understand your request correctly. Here two possible interpretations:

1. The data is autofiltered:


Book1
ABC
1xyz
2zada2
3zada3
4zadb5
9zada0
11
12a
132.5
Sheet1


In A13, control+shift+enter, not just enter:

=AVERAGE(IF($B$2:$B$10=A12,IF(SUBTOTAL(2,OFFSET($C$2,ROW($C$2:$C$10)-ROW($C$2),0)),IF(ISNUMBER($C$2:$C$10),IF($C$2:$C$10>0,$C$2:$C$10)))))

This computes a conditional average while data area in autofiltered on column A.

2. A conditional average without autofilter:

Control+shift+enter, not just enter...

=AVERAGE(IF(ConditionRange=Condition,IF(ISNUMBER(AverageRange),IF(AverageRange>0,AverageRange))))
 
Upvote 0
Wow! I must admit I thought I wouldn't get an answer, but yours seems to work! Amazing. I'm going to need some time to work through the formula so I understand it, but very impressive. Thanks so much!
 
Upvote 0
Wow! I must admit I thought I wouldn't get an answer, but yours seems to work! Amazing. I'm going to need some time to work through the formula so I understand it, but very impressive. Thanks so much!

You are very welcome. Thanks for providing feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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