Sumifs Multiple

billandrew

Well-known Member
Joined
Mar 9, 2014
Messages
743
Good evening all

Trying to sum/combine Column D values.

1. Monday & Tuesday
2.Thursday & Wednesday
3. Friday & Saturday

If Column E = TRUE and Column C = 2 for each unique ID.

attempted formula = =+IF(AND($E2=TRUE,$C2=2),IF(OR($B2="Monday",$B2="Tuesday"),SUMIFS(D$2:D$57,$B$2:$B$57,"Monday",$A$2:$A$57,$A2)+SUMIFS(D$2:D$57,$B$2:$B$57,"Tuesday",$A$2:$A$57,$A2),0))

IDDayCodeValueTRUE FALSE
131Thursday222.4TRUE
131Friday222.0TRUE
131Saturday224.8TRUE
131Wednesday225.6FALSE
131Monday222.9FALSE
131Tuesday223.1FALSE
131Sunday20.0FALSE
132Thursday223.5TRUE
132Friday228.3TRUE
132Saturday230.9TRUE
132Tuesday229.4FALSE
132Wednesday230.2FALSE
132Monday227.9FALSE
132Sunday20.0FALSE
133Thursday236.8TRUE
133Friday234.3TRUE
133Saturday233.1TRUE
133Tuesday237.9FALSE
133Monday241.2FALSE
133Wednesday231.5FALSE
133Sunday20.0FALSE
134Thursday234.9TRUE
134Friday225.7TRUE
134Saturday220.7TRUE
<colgroup><col width="70" style="width: 53pt;"> <col width="100" style="width: 75pt;"> <col width="70" style="width: 53pt;" span="2"> <col width="142" style="width: 107pt;"> <tbody> </tbody>
 
for each id 132 (column A). If column E is true & column c is equal to 2 sum column D and place the result adjacent to the TRUE value
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
for each id 132 (column A). If column E is true & column c is equal to 2 sum column D and place the result adjacent to the TRUE value

I don't think this is clear...

Is this what you want?

=SUMIFS(D:D,A:A,X2,C:C,2)

where X2 houses an id of interest.
 
Upvote 0
how do you get those "Monday, Tuesday,.......
are those actual dates formatted in a way that they appear as "Days" or are they just a text
 
Upvote 0
Try this confirmed with Ctrl + Shift + Enter

=IF(E2=FALSE,"No Value needed",SUM(SUMIFS(D$2:D$25,B$2:B$25,IF(OR(B2="Monday",B2="Tuesday"),{"Monday","Tuesday"},IF(OR(B2="Wednesday",B2="Thursday"),{"Wednesday","Thursday"},{"Friday","Saturday"})),C$2:C$25,2)))
 
Upvote 0
Or this with
Just Enter

=IF(E2=FALSE,"No Value needed",SUMPRODUCT(SUMIFS(D$2:D$25,B$2:B$25,IF(OR(B2="Monday",B2="Tuesday"),{"Monday","Tuesday"},IF(OR(B2="Wednesday",B2="Thursday"),{"Wednesday","Thursday"},{"Friday","Saturday"})),C$2:C$25,2)))
 
Upvote 0
if you want to include the criteria of ID number as well, you can do it like this:

=IF(E2=FALSE,"No Value needed",SUMPRODUCT(SUMIFS(D$2:D$7,$A$2:$A$7,A2,B$2:B$7,IF(OR(B2="Monday",B2="Tuesday"),{"Monday","Tuesday"},IF(OR(B2="Wednesday",B2="Thursday"),{"Wednesday","Thursday"},{"Friday","Saturday"})),C$2:C$7,2)))
 
Last edited:
Upvote 0
I was able to come up with the below, however much longer.

=+IF(AND($E2=TRUE,$C2=2),IF(OR($B2="Monday",$B2="Tuesday"),SUMIFS(D$2:D$57,$B$2:$B$57,"Monday",$A$2:$A$57,$A2)+SUMIFS(D$2:D$57,$B$2:$B$57,"Tuesday",$A$2:$A$57,$A2),IF(AND($E2=TRUE,$C2=2),IF(OR($B2="Wednesday",$B2="Thursday"),SUMIFS(D$2:D$57,$B$2:$B$57,"Wednesday",$A$2:$A$57,$A2)+SUMIFS(D$2:D$57,$B$2:$B$57,"Thursday",$A$2:$A$57,$A2),IF(AND($E2=TRUE,$C2=2),IF(OR($B2="Saturday",$B2="Friday"),SUMIFS(D$2:D$57,$B$2:$B$57,"Saturday",$A$2:$A$57,$A2)+SUMIFS(D$2:D$57,$B$2:$B$57,"Friday",$A$2:$A$57,$A2),0))))))+0
 
Upvote 0
You can try the below shorter versions

Code:
=IF(E2,SUMPRODUCT(SUMIFS(D$2:D$7,$A$2:$A$7,A2,B$2:B$7,VLOOKUP(left(B2,2)&"*",{"Mo","Tu";"Tu","Mo";"We","Th";"Th","We";"Fr","Sa";"Sa","Fr"}&"*",{1,2},0),C$2:C$7,2)),)

OR
Code:
=IF(E2,SUMPRODUCT(SUMIFS(D$2:D$7,$A$2:$A$7,A2,B$2:B$7,IF(OR(B2={"Monday","Tuesday"}),{"Mo*","Tu*"},IF(OR(B2={"Wednesday","Thursday"}),{"We*","Th*"},{"F*","Sa*"})),C$2:C$7,2)),)
 
Last edited:
Upvote 0
OR even shorter

=IF(E2,SUMPRODUCT(SUMIFS(D$2:D$7,$A$2:$A$7,A2,B$2:B$7,VLOOKUP(LEFT(B2,3)&"*",TEXT({2,3;3,2;4,5;5,4;6,7;7,6},"ddd")&"*",{1,2},0),C$2:C$7,2)),)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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