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
=INDEX($datarange,MAX((VerticalLookupValue=$NameRange)*MATCH(ROW($NameRange),ROW($NameRange))))

<tbody>
</tbody>

B) - Check several columns for a lookup value
=INDEX($dataRange,MATCH($verticalLookupValue,$verticalLookupRange,0),MIN(IF($dataRange=$horizontalLookupValue,COLUMN($ColumnRange)-10)))

<tbody>
</tbody>

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)
Date

<tbody>
</tbody>
Winner 1
Rating 1

<tbody>
</tbody>
Winner 2

<tbody>
</tbody>
Rating 2

<tbody>
</tbody>
Loser 1

<tbody>
</tbody>
Rating 1

<tbody>
</tbody>
Loser 2

<tbody>
</tbody>
Rating 2

<tbody>
</tbody>
W1

<tbody>
</tbody>
EndRating W1

<tbody>
</tbody>
W2

<tbody>
</tbody>
EndRating W2

<tbody>
</tbody>
L1

<tbody>
</tbody>
EndRatingL1

<tbody>
</tbody>
L2

<tbody>
</tbody>
EndRatingL2

<tbody>
</tbody>
12/03/2016

<tbody>
</tbody>
Smith

<tbody>
</tbody>
1100

<tbody>
</tbody>
Jones

<tbody>
</tbody>
1080

<tbody>
</tbody>
Smith

<tbody>
</tbody>
1106

<tbody>
</tbody>
Jones

<tbody>
</tbody>
1076

<tbody>
</tbody>
12/03/2016

<tbody>
</tbody>
Wu

<tbody>
</tbody>
1200

<tbody>
</tbody>
Zhang

<tbody>
</tbody>
1215

<tbody>
</tbody>
Jones

<tbody>
</tbody>
1076

<tbody>
</tbody>
Wu

<tbody>
</tbody>
1201

<tbody>
</tbody>
Zhang

<tbody>
</tbody>
1216

<tbody>
</tbody>
Jones

<tbody>
</tbody>
1074

<tbody>
</tbody>
12/03/2016

<tbody>
</tbody>
Wu

<tbody>
</tbody>
1201

<tbody>
</tbody>
Zhang

<tbody>
</tbody>
1215

<tbody>
</tbody>
Smith

<tbody>
</tbody>
1106

<tbody>
</tbody>
Wu

<tbody>
</tbody>
1204

<tbody>
</tbody>
Zhang

<tbody>
</tbody>
1219

<tbody>
</tbody>
Smith

<tbody>
</tbody>
1100

<tbody>
</tbody>
12/03/2016

<tbody>
</tbody>
Leclerc

<tbody>
</tbody>
1340

<tbody>
</tbody>
Jones

<tbody>
</tbody>
1074

<tbody>
</tbody>
Leclerc

<tbody>
</tbody>
1342

<tbody>
</tbody>
Jones

<tbody>
</tbody>
1072

<tbody>
</tbody>
12/03/2016

<tbody>
</tbody>
Leclerc

<tbody>
</tbody>
1342

<tbody>
</tbody>
Smith

<tbody>
</tbody>
1100

<tbody>
</tbody>
Leclerc

<tbody>
</tbody>
1344

<tbody>
</tbody>
Smith

<tbody>
</tbody>
1098

<tbody>
</tbody>
12/03/2016

<tbody>
</tbody>
Leclerc

<tbody>
</tbody>
1344

<tbody>
</tbody>
Wu

<tbody>
</tbody>
1204

<tbody>
</tbody>
Zhang

<tbody>
</tbody>
1219

<tbody>
</tbody>
Leclerc

<tbody>
</tbody>
1349

<tbody>
</tbody>
Wu

<tbody>
</tbody>
1202

<tbody>
</tbody>
Zhang

<tbody>
</tbody>
1217

<tbody>
</tbody>
12/03/2016

<tbody>
</tbody>
dummy

<tbody>
</tbody>
Leclerc

<tbody>
</tbody>
1349

<tbody>
</tbody>

<tbody>
</tbody>

Let me know if I can provide any more information.

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

Thank you all!
 
Right, I found a formula which claims to use offset/match to return a range of cells that match a lookup value. I was thinking I could put this formula in to the array for the INDEX clause, to make the array dependent on matching the relevant date criteria.

The two problems I have here are that the formula doesn't bring back a range, it brings back the number of cells in the range - presumably because it's using COUNTIF, but I don't know what to replace that with.
Secondly, if it did bring back a range, it would be the range containing the date values, rather than the range 15 (or 17, etc) columns to the left, where the data I want is.

The formula I found, adjusted to fit my data, is:
=COUNTIF(OFFSET($A$7:$A$13,MATCH($E$3,$A$7:$A$13,0)-1,0,MATCH(TRUE,OFFSET($A$7:$A$13,MATCH($E$3,$A$7:$A$13,0),0)<>$E$3,0)),42441)
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
have a look to see of this work for you.
Green cells altered for testing.

Formula in L12 and M12 can copy down to cover L3 to L6 if they follow the same format.


Excel 2012
ABJKLMNOPQRST
1DateWinner 1W1EndRating W1W2EndRating W2L1EndRatingL1L2EndRatingL2L3
212/03/2016SmithSmith1106Jones1076
312/03/2016WuWu1201Zhang1216Jones1074
412/03/2016WuWu1204Zhang1219Smith1100Smith1000
512/03/2016LeclercLeclerc1342Jones1072
612/03/2016LeclercLeclerc1344Smith1098
712/03/2016LeclercLeclerc1349Wu1202Smith1000
813/03/2016dummySmith888
9
1012/03/2016
11Smith
12L161098
13L271000
14L341000
15L400
16L500
17L600
18EndRatingL11000
Sheet6
Cell Formulas
RangeFormula
M12=IF(L12=0,0,INDEX($O$1:$Z$8,L12,MATCH(K12,$O$1:$Z$1,0)+1))
M18=INDEX(M12:M17,MATCH(MAX(L12:L17),L12:L17,0))
L12{=MAX(IF($A$1:$A$8=$K$10,ROW($A$1:$A$8)*(INDEX($O$1:$Z$8,0,MATCH(K12,$O$1:$Z$1,0))=$K$11)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Thanks AlanY!
It definitely works, which is fantastic. It'll mean that I need to add 6 hidden columns and a hidden row to the second tab where the end of race ratings will be held, to store the calculations, which isn't ideal, but it's still a working method.

Now I just have to study your formulae for future reference!
Thanks again!
 
Upvote 0

Forum statistics

Threads
1,216,127
Messages
6,129,024
Members
449,482
Latest member
al mugheen

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