SUMIF INDEX MATCH for data before and including dates

Kaelthas

New Member
Joined
Dec 19, 2017
Messages
3
ABCDEFGHIJ
1SIZEITEMAPR-14MAY-14JUN-14SIZEITEMPERIODAMOUNT
20.200SCOTCH12030.200SCOTCHMAY-1420
30.375RUM456
40.375VODKA789
50.250SCOTCH101112

<tbody>
</tbody>

<tbody>
</tbody>
Good day all.

I'm looking for a formula to sum information based on more than one criteria (in this case, size, item and period) over columns and rows before and including a specific period. Say, the amount of 0.200 Scotch until the end of May 2014, which is 21.

<tbody>
</tbody>
Code:
[TABLE="width: 793"]
<tbody>[TR]
[TD]=SUMIFS(INDEX($C$2:$E$5,0,MATCH(I2,$C$1:$E$1,0)),$A$2:$A$5,G2,$B$2:$B$5,H2)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
This formula only present the amount for a specific period though.

Any assistance would be greatly appreciated!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I am sure there shuold be a shorter way but this is the best I can do:

=SUMIF(C1:E1,"<="&I2,INDIRECT("C"&SMALL(IF(COUNTIF($G$2,$A$1:$E$6)*COUNTIF($H$2,$B$1:$B$6),ROW($A$1:$E$6)-MIN(ROW($A$1:$E$6))+1),ROW(A1))&":E"&SMALL(IF(COUNTIF($G$2,$A$1:$E$6)*COUNTIF($H$2,$B$1:$B$6),ROW($A$1:$E$6)-MIN(ROW($A$1:$E$6))+1),ROW(A1))))
 
Last edited by a moderator:
Upvote 0
I am sure there shuold be a shorter way but this is the best I can do:

=SUMIF(C1:E1,"<="&I2,INDIRECT("C"&SMALL(IF(COUNTIF($G$2,$A$1:$E$6)*COUNTIF($H$2,$B$1:$B$6),ROW($A$1:$E$6)-MIN(ROW($A$1:$E$6))+1),ROW(A1))&":E"&SMALL(IF(COUNTIF($G$2,$A$1:$E$6)*COUNTIF($H$2,$B$1:$B$6),ROW($A$1:$E$6)-MIN(ROW($A$1:$E$6))+1),ROW(A1))))


Here is a shorter version:

=SUMIF(C1:E1,"<="&I2,INDIRECT("C"&MATCH(G2&H2,A:A&B:B,0)&":E"&MATCH(G2&H2,A:A&B:B,0)))
 
Upvote 0
Hi Flashbond.

Another one for you, what if I had duplicate items in column A and B? Say if B4 was also "Rum"?

Thanks and regards.
 
Upvote 0
Can you use this? My answer got 21.
=SUM(IF($A$2:$A$5=$F$2,IF($B$2:$B$5=$G$2,IF($C$1:$E$1<=$H$2,$C$2:$E$5))))

<tbody>
</tbody>

SizeItemApr-14May-14Jun-14SizeItemPeriodAmount
0.2Scotch12030.2ScotchMay-1421
0.375Rum456
0.375Vodka789
0.25Scotch101112

<colgroup><col span="2"><col><col><col span="5"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,613
Members
449,238
Latest member
wcbyers

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