=AVERAGEIFS Incorporating an OR criteria

lnapier

New Member
Joined
Jun 28, 2005
Messages
16
In the below formula I need to incorporate some sort of OR function to average rows that reflect APPLE "AND" RED that are ROTTEN OR FRESH. The way I have it below adds two averages together, which doesn't come up with the correct result. Any ideas?
=
AVERAGEIFS(A:A,B:B,"="&"APPLE",C:C,"="&"RED",D:D,"="&"ROTTEN")+
AVERAGEIFS(A:A,B:B,"="&"APPLE",C:C,"="&"RED",D:D,"="&"FRESH")
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi

Try this array formula:

=AVERAGE(IF(B2:B1000="APPLE",IF(C2:C1000="RED",IF((D2:D1000="ROTTEN")+(D2:D1000="FRESH"),A2:A1000))))

This is an array formula, you have to confirm it with CTRL-SHIFT-ENTER and not just ENTER.
 
Upvote 0
a bit more messy formula can also be...

=IFERROR(SUMPRODUCT(IFERROR(($A$2:$A$10)/((($B$2:$B$10)="apple")*(($C$2:$C$10)="red")*((($D$2:$D$10)="rotten")+(($D$2:$D$10)="fresh")));""))/(SUMPRODUCT(((($B$2:$B$10)="apple")*(($C$2:$C$10)="red")*((($D$2:$D$10)="rotten")+(($D$2:$D$10)="fresh")))));0)

also requires CTRL SHIFT ENTER
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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