Index Match sum if with multiple criteria

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
200
Office Version
  1. 2013
Platform
  1. Windows

Excel 2007
ABCDEFGHIJK
1Scenario 1 (ID & LTM/PLTMScenario 2 (ID & Region & LTM/PLTM)Scenario 3 (ID & Country & LTM/PLTM)
2ID12345
3
4ProductLTMPLTMRegionLTMPLTMCountryLTMPLTM
5Core cash$ 80$ 110EMEA$ 190$ 300India$ 280$ 283
6Liquidity$ 29$ 89APAC$ 280$ 283Brazil$ 225$ 290
7FX$ 30$ 55LATAM$ 225$ 290France$ 190$ 300
8Lending$ 25$ 45
9
Sheet1









Excel 2007
ABCDEFGHIJKL
1LTMPLTM
2IDBanker IDRegionCountryCore cashLiquidityFXLendingCore cashLiquidityFXLending
31234522APACIndia$ 55$ 65$ 75$ 85$ 95$ 45$ 65$ 78
45564744EMEAFrance$ 29$ 89$ 55$ 65$ 75$ 85$ 95$ 45
51234566LATAMBrazil$ 30$ 55$ 65$ 75$ 85$ 95$ 45$ 65
61234588EMEAFrance$ 25$ 45$ 55$ 65$ 75$ 85$ 95$ 45
Sheet2





Sheet 1 have 3 different scenario.


Scenario 1 (ID & LTM/PLTM
Scenario 2 (ID & Region & LTM/PLTM)
Scenario 3 (ID & Country & LTM/PLTM)


Sheet 2 have Raw data


Scenario 1 (ID & LTM/PLTM - if ID (Cell B2 i.e.12345), Product is Corecash (A5) and time period is LTM (B4) then
cell b5 should do sum of all these conditions and return value $ 80

Scenario 2 (ID & Region & LTM/PLTM) - if ID (Cell B2 i.e.12345), Region is EMEA (E5) and
time period is LTM (F4) then cell F5 should do sum of all these conditions and return value $ 190

Scenario 3 (ID & Country & LTM/PLTM) - if ID (Cell B2 i.e.12345), Country is India (I5) and
time period is LTM (J4) then cell J5 should do sum of all these conditions and return value $ 280


based on data in sheet 2 i should get the output numbers in sheet 1

Is it possible?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
In Scenario 1 there are 3 instances of ID 12345.

The array is {55;0;30;25}. It's sum is 110.

What am I missing?
 
Last edited:
Upvote 0
My sincere apologies. You are right FlameRetired. please find the revised scenario output




Excel 2007
ABCDEFGHIJK
1Scenario 1 (ID & LTM/PLTMScenario 2 (ID & Region & LTM/PLTM)Scenario 3 (ID & Country & LTM/PLTM)
2ID12345
3
4ProductLTMPLTMRegionLTMPLTMCountryLTMPLTM
5Core cash$ 110$ 255EMEA$ 190$ 300India$ 280$ 283
6Liquidity$ 165$ 225APAC$ 280$ 283Brazil$ 225$ 290
7FX$ 195$ 205LATAM$ 225$ 290France$ 190$ 300
8Lending$ 225$ 188
Sheet1
 
Upvote 0
In B5 control+shift+enter, not just enter, and copy down:

=SUM(IF(Sheet2!$A$3:$A$6=$B$2,INDEX(Sheet2!$E$3:$H$6,0,MATCH($A5,Sheet2!$E$2:$H$2,0))))

In C5 control+shift+enter, not just enter, and copy down:

=SUM(IF(Sheet2!$A$3:$A$6=$B$2,INDEX(Sheet2!$I$3:$L$6,0,MATCH($A5,Sheet2!$I$2:$L$2,0))))

The rest should follow the same logic...
 
Upvote 0
Thank You Aladin! your formulas works like a charm. i have 2 quick question.

1 - How do i make the range dynamic? the no. of records in sheet 2 will be dynamic.

2- what if i have to add 1 or 2 more conditions to sum?
 
Last edited:
Upvote 0
Also I am not able to run the formula for scenario 2, can you plz help?
 
Upvote 0
Also I am not able to run the formula for scenario 2, can you plz help?

F5, control+shift+enter and copy down:

=SUM(IF(Sheet2!$A$3:$A$6=$B$2,IF(Sheet2!$C$3:$C$6=$E5,INDEX(Sheet2!$E$3:$H$6,0,MATCH($A5,Sheet2!$E$2:$H$2,0)))))

G5, control+shift+enter and copy down:

=SUM(IF(Sheet2!$A$3:$A$6=$B$2,IF(Sheet2!$C$3:$C$6=$E5,INDEX(Sheet2!$I$3:$L$6,0,MATCH($A5,Sheet2!$I$2:$L$2,0)))))
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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