Possible SUMPRODUCT & HLOOKUP?

pauleconkle

New Member
Joined
Dec 14, 2016
Messages
8
Hello and thanks in advance for any help! I have a table below; I then have 3 input cells; Country, City and Grade (the list is essentially 2K rows) so if input cell 'Country' is USA and they select 'NYC' for next input cell...and select 'Grade K B' for the third cell, I need a return of the corresponding amount (11,000). Also, is there a way to then return (in another cell) the next grade amount (so one cell would return 11,000 and the next cell would return 15,000) in the example below. Thanks again!

CountryCityGrade K AGrade K BGrade 1 AGrade 1B
USANYC10,00011,00015,00016,000
IrelandDublin5,0006,0007,0008,000
AfghanistanKabul1,0002,0003,0004,000

<tbody>
</tbody>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
A
B
C
D
E
F
1
Country
City
Grade K A
Grade K B
Grade 1A
Grade 1B
2
USA
NYC
10,000
11,000
15,000
16,000
3
Ireland
Dublin
5,000
6,000
7,000
8,000
4
Afganistan
Kabul
1,000
2,000
3,000
4,000
5
6
Country
USA
11,000
15,000
7
City
NYC
8
Grade
Grade K B
9

<tbody>
</tbody>

In C7 enter the array formula. Must be entered with Control+Shift+Enter.
Code:
=INDEX(C2:F4,MATCH(B7&B8,A2:A4&B2:B4,0),MATCH(B9,C1:F1,0))

In D7 enter the array formula. Must be entered with Control+Shift+Enter. I assumed if the last column was pulled up so there was no next grade this should be blank.
Code:
=IFERROR(INDEX(C2:F4,MATCH(B7&B8,A2:A4&B2:B4,0),MATCH(B9,C1:F1,0)+1),"")
 
Upvote 0
How's this?


Excel 2010
ABCDEFGHIJKL
1CountryCityGrade K AGrade K BGrade 1 AGrade 1BCountyCityGradeResultNext grade amount
2USANYC10,00011,00015,00016,000USANYCGrade K B1100015000
3IrelandDublin5,0006,0007,0008,000
4AfghanistanKabul1,0002,0003,0004,000
Sheet1
Cell Formulas
RangeFormula
K2=SUMPRODUCT((A2:A4=H2)*(B2:B4=I2)*(C1:F1=J2)*(C2:F4))
L2{=INDEX(C2:F4,MATCH(H2&I2,A2:A4&B2:B4,0),MATCH(J2,C1:F1,0)+1)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
How's this?

Excel 2010
ABCDEFGHIJKL
1CountryCityGrade K AGrade K BGrade 1 AGrade 1BCountyCityGradeResultNext grade amount
2USANYC10,00011,00015,00016,000USANYCGrade K B1100015000
3IrelandDublin5,0006,0007,0008,000
4AfghanistanKabul1,0002,0003,0004,000

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
K2=SUMPRODUCT((A2:A4=H2)*(B2:B4=I2)*(C1:F1=J2)*(C2:F4))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
L2{=INDEX(C2:F4,MATCH(H2&I2,A2:A4&B2:B4,0),MATCH(J2,C1:F1,0)+1)}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
Thank you! These worked perfectly!
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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