# =AVERAGEIFS Incorporating an OR criteria

#### lnapier

##### New Member
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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
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.

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

Replies
2
Views
588
Replies
6
Views
584
Replies
3
Views
399
Replies
3
Views
121
Replies
9
Views
393

1,196,487
Messages
6,015,498
Members
441,898
Latest member
kofafa

### 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.

### Which adblocker are you using?

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

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