INDEX-MATCH (or alternatives) with multiple columns

Malachite84

New Member
Joined
Mar 8, 2016
Messages
9
Hello All,

This is a first post, so apologies if I break any guidelines.

Summary: I'm working with a dataset where the values I want to retrieve need to be the last row meeting the criteria (containing the correct date and name), but could fall into one of six columns. I've seen various versions of INDEX-MATCH formulae which cover some of the aspects I need, but can't work out how to merge them, or even if that is possible. Any advice would be very greatly appreciated.

Extended Version:
The dataset relates to motor-racing rankings based on race results, organised pairwise, so each one row contains a record of one driver beating another in a given race on a given date, and the associated exchange of ranking points between them. This interacts with a second sheet that contains the 'end of race' values for each driver. I have already created Index-Match-Match formulae that populate the driver data which are fed into the calculations, but want to create one in the second sheet that retrieves the 'end of race' values.

The complicating factor here is that some race entries consist of co-drivers, and therefore there isn't one 'Driver' column for the winner and loser - there are up to six.

Consequently, I need a formula that can:
1) - Look up records with the correct date in Column A.
2) - Look up records with the correct Losing Driver in any of Columns AA, AC, AE, AG, AI, or AK
3) - Identify which of the records meeting the two criteria above is in the highest value row (i.e., further down the worksheet)
4) - Retrieve the appropriate Losing Driver New Rating in any of Columns AB, AD, AE, AH, AJ, or AL.

I've seen formulae that can:
A) - Return the last occurrence of a lookup value
[TABLE="width: 114"]
<tbody>[TR]
[TD="class: xl63"]=INDEX($datarange,MAX((VerticalLookupValue=$NameRange)*MATCH(ROW($NameRange),ROW($NameRange))))[/TD]
[/TR]
</tbody>[/TABLE]

B) - Check several columns for a lookup value
[TABLE="width: 114"]
<tbody>[TR]
[TD]=INDEX($dataRange,MATCH($verticalLookupValue,$verticalLookupRange,0),MIN(IF($dataRange=$horizontalLookupValue,COLUMN($ColumnRange)-10)))[/TD]
[/TR]
</tbody>[/TABLE]

The problem being, that the first won't check multiple columns, and the second only retrieves the first result.

I've also seen other formula of different constructions, which seem to be dealing with similar issues, but I'm not sure if these will solve my problems (cell/range references as quoted in the source text, and not relevant to my data)
e.g.
=INDEX($B$4:$M$5,MATCH(A9,$A$4:$A$5,0),MATCH(1,IF($B$1:$M$1=B9,IF($B$2:$M$2=C9,IF($B$3:$M$3=D9,1))),0))

As stated above, any help or advice would be great, even if just links to good guides on how to merge MIN/MAX/IF/AND into INDEX-MATCH formula.

Here's a mock of the kind of data I'm dealing with. I've not included any data columns that aren't relevant, and I've only put in two driver columns for simplicity here, rather than the six required. I've highlighted in bold the data that I need to be finding and retrieving.

Data Sample (not genuine, but in the right format)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65"]Date[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Winner 1[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Rating 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Winner 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Rating 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Loser 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Rating 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Loser 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Rating 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]W1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]EndRating W1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]W2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]EndRating W2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]L1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]EndRatingL1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]L2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]EndRatingL2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65, align: right"]12/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Smith[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1100[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Jones[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1080[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Smith[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1106[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Jones[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1076[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65, align: right"]12/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Wu[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1200[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Zhang[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1215[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Jones[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1076[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Wu[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1201[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Zhang[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1216[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Jones[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1074[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65, align: right"]12/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Wu[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1201[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Zhang[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1215[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Smith[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1106[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Wu[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1204[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Zhang[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1219[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Smith[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1100[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65, align: right"]12/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Leclerc[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1340[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Jones[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1074[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Leclerc[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1342[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Jones[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, align: right"]1072[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65, align: right"]12/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Leclerc[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1342[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Smith[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1100[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Leclerc[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1344[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Smith[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, align: right"]1098[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65, align: right"]12/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Leclerc[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1344[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Wu[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1204[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Zhang[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1219[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD]Leclerc[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="align: right"]1349[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Wu[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, align: right"]1202[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Zhang[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, align: right"]1217[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 75"]
<tbody>[TR]
[TD="class: xl65, align: right"]12/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]dummy[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65"]Leclerc[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, align: right"]1349[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Let me know if I can provide any more information.

(Issue while posting this, hope it hasn't double posted)

Thank you all!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I've thought about this since yesterday, and written the following formula. This is able to search multiple columns for the lowest row, using IF conditions - but it can't check multiple columns for the matching data value.

=INDEX($P$6:$P$12, IF(MAX( ($D$3=$O$6:$O$12)*MATCH(ROW($O$6:$O$12),ROW($O$6:$O$12)))> MAX(($D$3=$Q$6:$Q$12)*MATCH(ROW($Q$6:$Q$12),ROW($Q$6:$Q$12))),MAX(($D$3=$O$6:$O$12)*MATCH(ROW($O$6:$O$12),ROW($O$6:$O$12))),MAX(($D$3=$Q$6:$Q$12)*MATCH(ROW($Q$6:$Q$12),ROW($Q$6:$Q$12)))))

I'll keep retooling this, but hoping someone can advise in the meantime.
Thanks again!
 
Upvote 0
the sample data posted don't have the row/column references made it difficult to understand.

is it possible to share the sample file on dropbox or google drive etc?
 
Upvote 0
Thanks AlanY
The sample data represents Columns A:R, if that makes it easier. I can't share a file at present but could do so later.


Update 2:
I aimed to nest the INDEX within the IF clauses, such that if the lowest matching row is in column O, there is an index against column P, but if the lowest matching row is not in column O, there is an index against column Q.

It works - although I'll have to build up the formula with further nest If/Index/Match combinations to cover six potential columns. For reference, here's the working formula for 2-column pairs:
=IF(MAX(($D$3=$O$6:$O$12)*MATCH(ROW($O$6:$O$12),ROW($O$6:$O$12)))>MAX(($D$3=$Q$6:$Q$12)*MATCH(ROW($Q$6:$Q$12),ROW($Q$6:$Q$12))), INDEX($P$6:$P$12, MAX(($D$3=$O$6:$O$12)*MATCH(ROW($O$6:$O$12),ROW($O$6:$O$12)))), INDEX($R$6:$R$12, MAX(($D$3=$Q$6:$Q$12)*MATCH(ROW($Q$6:$Q$12),ROW($Q$6:$Q$12)))))
 
Upvote 0
Although after a moment of excitement, I've realised this formula doesn't also check against the date match, so I'll have to build that in as well - starting with working out whether the date match needs to be built into each IF clause, or can be given once, outside the IF clauses.

Apologies for spamming my own question, but I can't edit my own posts.

Thanks all.
 
Upvote 0
right, based on the sample data columns A-R.

let say we are looking at 12/03/2016, loser driver Smith.
are we trying to locate Smith in Columns K to Q, once Smith was found in Column O then look down to Row 6 and get 1098 from Cell P6?
 
Upvote 0
That's exactly right, AlanY - with the added complexity that there will be data from different dates in the same table.
 
Upvote 0
more question.

on the same date, will Smith can also appears on Column Q (L2)?
you are only looking for the losers but not winners, right? i.e. from Column O, rather than K to R.
 
Last edited:
Upvote 0
Yes, Smith could appear in L2 on the same date (ie, being a co-driver on two entries in the same race).
However, I'm only interested in retrieving the result from lowest row (on this date) in which Smith appears, regardless of whether he appears in multiple loser columns
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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