INDEX and MATCH: lookups to the left and two-way: practice exercises
MATCH across a row, is it on the list, lookups to the left, top seller, two-way lookup. 5 exercises on real-looking data, each marked the moment you press Check. The first exercise is below to try now; the full lesson is part of Pro.
Row 1 lists the speakers at a meeting in the order they speak. In B4, use MATCH to find which slot the person named in B3 has.
| A | B | C | D | E | F | G | H | I | J | K | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Speaking order | Ben | Grace | Hannah | Will | Maria | Femi | Marek | Rachel | Owen | Chen |
| 2 | |||||||||||
| 3 | Name | Maria | |||||||||
| 4 | Slot |
How it works
MATCH tells you where something is; INDEX tells you what is at a position. These five exercises use them on their own and together.
Two handy patterns: ISNUMBER(MATCH(x, list, 0)) is TRUE when x is on the list, and INDEX(names, MATCH(MAX(scores), scores, 0)) finds who has the top score.
=MATCH("Wed",B1:F1,0) =ISNUMBER(MATCH(A3,$E$2:$E$5,0)) =INDEX(A2:A6,MATCH(MIN(C2:C6),C2:C6,0))
MATCH across and down
MATCH works on a column (A2:A6) or a row (B1:F1) in the same way: it counts along from the first cell. Always give 0 as the last argument unless you want bands.
If the value isn't there, MATCH gives #N/A. That's useful: ISNUMBER(MATCH(...)) turns found or not found into TRUE or FALSE.
Worked example
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Team | Score | Passed | |
| 2 | Amira | Sales | 64 | Ben | |
| 3 | Ben | Finance | 81 | Ewa | |
| 4 | Cara | Sales | 58 | Dev | |
| 5 | Dev | IT | 90 | ||
| 6 | Ewa | Finance | 73 |
=ISNUMBER(MATCH(A3,$E$2:$E$4,0))in G2. Ben is in the Passed list, so MATCH gives a number and ISNUMBER gives TRUE.=ISNUMBER(MATCH(A4,$E$2:$E$4,0))in G3. Cara isn't there. MATCH gives #N/A, which isn't a number, so the answer is FALSE.=INDEX(A2:A6,MATCH(MAX(C2:C6),C2:C6,0))in G4. MAX finds the top score (90), MATCH finds where it is (4th), and INDEX gives the 4th name: Dev.
Two MATCHes for a grid
Give INDEX a block of values, then a row number and a column number. Use one MATCH down the side for the row and one MATCH across the top for the column:
=INDEX(values, MATCH(row label, side labels, 0), MATCH(column label, top labels, 0))
Leave the labels out of the block of values, and make each list of labels the same length as that side of the block.
What you'll practise
- Row 1 lists the speakers at a meeting in the order they speak. In B4, use MATCH to find which slot the person named in B3 has.
- E2:E9 lists the people who have completed first aid training. In B2, show TRUE if the person in column A is on that list and FALSE if not, using ISNUMBER and MATCH. Copy it down.
- The payroll number is in column C, to the right of the names, so VLOOKUP can't do this. In I2, use INDEX and MATCH to show the name of the person whose payroll number is in I1.
- In I1, show the name of the person with the highest sales. Find the top figure with MAX, its position with MATCH, and the name with INDEX.
- The price list shows the hire price of each room for each kind of session. In H3, show the price for the room in H1 and the session in H2, using INDEX with two MATCHes.
Guides with worked examples: Compare two lists in Excel · XLOOKUP: a simple worked example