SUMIFS with OR statement

bluegold

Active Member
Joined
Jun 21, 2009
Messages
279
Hi guys this one is tricky, well for me at least!
I have the following SUMIFS statement that adds column AL when a bunch of conditions are met with my other columns. What I want to do is have an OR statement somehow nested so only one of the 2 highlighted red conditions need to be met. So all the conditions in black text have to be met but only either en!Q:Q,"=1" OR en!:P:P"=1" need to be met for my final condition.

=SUMIFS(en!AL:AL,en!D:D,">="&$B$1,en!D:D,"<="&$C$1,en!A:A,">="&$F$1,en!A:A,"<="&$G$1,en!P:P,"=D01",AO:AO,"<>nd",en!Q:Q,"=1" OR en!:P:P"=1")

Does this make sense?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Do you mean:
Code:
=SUMIFS(en!AL:AL,en!D:D,">="&$B$1,en!D:D,"<="&$C$1,en!A:A,">="&$F$1,en!A:A,"<="&$G$1,en!P:P,"=D01",AO:AO,"<>nd")+sumif(en!Q:Q,1,en!AL:AL)+sumif(en!P:P,1,en!AL:AL)
 
Upvote 0
You won’t be able to do that with a single SUMIFS

Either switch to SUMPRODUCT or use 3 SUMIFS - one with each of your OR conditions separately then subtract a SUMIFS with both conditions to avoid double counting - how many rows of data are there?
 
Upvote 0
Bluegold,

I would suggest a helper column in sheet "en":
Code:
=OR(P2=1,Q2=1)
And use this helper column in your SUMIFS() with criteria TRUE.
 
Upvote 0
I would use the following :)

=SUM(IF((en!D:D>=$B$1)*(en!D:D<=$C$1)*(en!A:A>=$F$1)*(en!A:A<=$G$1)*(en!P:P="D01")*(AO:AO<>"nd")*((en!Q:Q=1)+(en!P:P=1)),en!AL:AL))

Pressing CONTROL+SHIFT+ENTER instead of just enter, as it's an array formula
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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