fable

New Member
Joined
Nov 16, 2012
Messages
24
Hey guys,

Just looking for a quick bit of help.

Looking to use averageif for two conditions. Normally I'd use the averageifs formula, but, it's not two conditions on one value it's one value where it can be A or B. I've even tried the OR function with no success...

So, what I've tried to do is compensate and do it manually. This is giving me different answers no matter how I do it.

=(SUMIF(L:L,"A",A:A)+SUMIF(L:L,"B",A:A))/(COUNTIF(L:L,"A")+COUNTIF(L:L,"B"))

That should be a manual average, unless I'm mistaken, but the value it's giving me is way off what I'd be expecting. (i.e the above =77.... when the two individually average 90 & 84 respectively.)

So, I'm pretty sure this is wrong. anyone mind pointing out what I'm doing and a neater way of doing this?

Thanks in advance!

-fable
 
You didn't mention that you had text in column C. Those entries will be treated as zero. Try this:

=SUM(SUMIF(E:E,{"C","G"},C:C))/SUMPRODUCT(((E:E="C")+(E:E="G")),--ISNUMBER(C:C))
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I wasn't aware it would make a big difference as you can only average numbers. But, having tried that, curiously the averages still do not match. It now comes to 88.42 as opposed to the expected 88.05. Not a big difference, but there must be an error somewhere around there...

I would have expected there to be a simpler way of doing this.
 
Upvote 0
88.05 is the average of all the data, not just the filtered data. If you want an average of the filtered data use:

=SUBTOTAL(1,C:C)
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,387
Members
449,445
Latest member
JJFabEngineering

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