"double" INDEX & MATCH search?

jxb

Board Regular
Joined
Apr 19, 2007
Messages
172
Office Version
  1. 2010
Platform
  1. Windows
to all

I am trying to do a "double" search with Index & MATCH
I want to return the value in the header (row 7) corresponding to the max value - See attached test
I find the max value - cell c2
and find the ID corresponding to the max value (cell c3) using a match
I know would like to return the case (row 7) corresponding to the max value & ID - in the test v5

This is a test but I'd any (row) range dynamic. Is this possible with INDIRECT,INDEX & MATCH?

How can this be done?

Thanks in advance
 
the proposed solutions (great ones) are combining functions which I am trying to understand
Eric's formula works on the max value whereas I'd like to work on the ID. The reasons as pointed out is that it's possible that one can end up with a number of max values being equal (the same) but ID will always be unique
Just did a test where the max values are the same (different case) for both sets and indeed the 2nd set returns the wrong case


Book1
BCDEFGHI
2max1=1
3ID1 =1
4case =v1v1
5max2=1
6ID1 =102
7case =#REF!v1<--wrong
8
9
10IDmaxv1v2v3v4v5
11111.0000.3570.9090.8130.650
1220.8858650.2000.8860.4720.3240.100
1330.87970.0870.1640.8800.0140.491
14780.9333280.5580.6600.8180.7970.933
15990.9189750.1920.5130.9100.2010.919
161010.985620.9860.6370.3940.0410.774
1710210.5000.2160.1540.6881.000
181030.9941720.2350.7960.5500.9940.234
191040.9502870.6130.4800.5560.9500.056
Sheet2
Cell Formulas
RangeFormula
D4=INDEX(headerrow,MATCH(C2,INDEX(WholeDataSet,MATCH(C2,C11:C15,0),0),0))
D7=INDEX(headerrow,MATCH(C5,INDEX(WholeDataSet,MATCH(C5,C11:C19,0),0),0))
C2=MAX(C11:C15)
C3=INDEX(B11:B15,MATCH(C2,C11:C15,0))
C4=INDEX(headerrow,SUMPRODUCT((E11:I15=MAX(E11:I15))*COLUMN(E11:I15))-COLUMN(E11:I15)+1)
C5=MAX(C16:C19)
C6=INDEX(B16:B19,MATCH(C5,C16:C19,0))
C7=INDEX(headerrow,SUMPRODUCT((WholeDataSet=MAX(WholeDataSet))*COLUMN(WholeDataSet))-COLUMN(WholeDataSet)+1)
C11=MAX(E11:I11)
C12=MAX(E12:I12)
C13=MAX(E13:I13)
C14=MAX(E14:I14)
C15=MAX(E15:I15)
C16=MAX(E16:I16)
C17=MAX(E17:I17)
C18=MAX(E18:I18)
C19=MAX(E19:I19)
Named Ranges
NameRefers ToCells
headerrow=Sheet2!$E$10:$I$10
WholeDataSet=Sheet2!$E$11:$I$19
 
Last edited:
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
If you want to use the ID to specify the row use this version of Eric's formula
=INDEX(E7:I7,MATCH(C2,INDEX(E8:I12,MATCH(C3,B8:B12,0),0),0))
 
  • Like
Reactions: jxb
Upvote 0
Thanks. Looks like it's working. set up a test with all the names (easier to read) see below and will go away and work on my real data set (which is very large)


Book1
BCDEFGHI
2max1=1.2
3ID1 =78
4case for max1=v3
5max2=1
6ID2 =102
7case for max2=v5
8
9
10IDmaxv1v2v3v4v5
11111.0000.3570.9090.8130.650
1220.8858650.2000.8860.4720.3240.100
1330.87970.0870.1640.8800.4500.491
14781.20.6000.6601.2000.7970.933
15990.9189750.1920.5130.9100.2010.919
161010.985620.9860.6370.3940.0410.774
1710210.5000.2160.1540.6881.000
181030.9941720.2350.7960.5500.9940.234
191040.9502870.6130.4800.5560.9500.056
Sheet2
Cell Formulas
RangeFormula
C2=MAX(C11:C15)
C3=INDEX(B11:B15,MATCH(C2,C11:C15,0))
C4=INDEX(headerrow,MATCH(_Max1,INDEX(WholeDataSet,MATCH(_ID1,IDRg,0),0),0))
C5=MAX(C16:C19)
C6=INDEX(B16:B19,MATCH(C5,C16:C19,0))
C7=INDEX(headerrow,MATCH(_Max2,INDEX(WholeDataSet,MATCH(_ID2,IDRg,0),0),0))
C11=MAX(E11:I11)
C12=MAX(E12:I12)
C13=MAX(E13:I13)
C14=MAX(E14:I14)
C15=MAX(E15:I15)
C16=MAX(E16:I16)
C17=MAX(E17:I17)
C18=MAX(E18:I18)
C19=MAX(E19:I19)
Named Ranges
NameRefers ToCells
_ID1=Sheet2!$C$3
_ID2=Sheet2!$C$6
_Max1=Sheet2!$C$2
_Max2=Sheet2!$C$5
headerrow=Sheet2!$E$10:$I$10
IDRg=Sheet2!$B$11:$B$19
WholeDataSet=Sheet2!$E$11:$I$19
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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