AVERAGEIFS with OR condition

creative999

Board Regular
Joined
Jul 7, 2021
Messages
108
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Trying to work out the average based on a OR condition. For example:

IF A=Mens
AND
B=Retail or Warehouse
then calculate average $ from C
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try:
Book1
ABCDE
1Mensretail1
2Womenretail22.5
3Womenwarehouse3
4Menswarehouse4
5Mensother5
Sheet1
Cell Formulas
RangeFormula
E2E2=AVERAGE(AVERAGEIFS(C1:C5,A1:A5,"mens",B1:B5,{"retail","warehouse"}))
 
Upvote 0
Try:
Book1
ABCDE
1Mensretail1
2Womenretail22.5
3Womenwarehouse3
4Menswarehouse4
5Mensother5
Sheet1
Cell Formulas
RangeFormula
E2E2=AVERAGE(AVERAGEIFS(C1:C5,A1:A5,"mens",B1:B5,{"retail","warehouse"}))
Thank you, but this doesnt work (DIV error) if there's no MENS RETAIL or MENS WAREHOUSE
 
Upvote 0
How about
Excel Formula:
=AVERAGE(FILTER(C2:C100,(A2:A100="mens")*((B2:B100="retail")+(B2:B100="warehouse"))))
 
Upvote 0
Solution
Do you have any #value errors in cols A or B
 
Upvote 0
You could wrap my formula in the IFERROR function (Fluff's too). This will return a 0, but you can change it to blank or anything slse you want to return for no data.
Change cells ranges to match your data.
=IFERROR(AVERAGE(AVERAGEIFS(C1:C5,A1:A5,"mens",B1:B5,{"retail","warehouse"})),0)
 
Upvote 0
Averaging averages will often give the wrong result.
 
Upvote 0
I would go with Fluff's formula, mine seems to pick up some bad data.
 
Upvote 0

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

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