Look up with INDEX and MATCH

Lookups · About 6 minutes

Look up with INDEX and MATCH

MATCH finds where something is in a list. MATCH(B9,B2:B7,0) gives 4 if B9 is the 4th item. The 0 means exact match only.

INDEX picks the item at a position. INDEX(C2:C7,4) gives the 4th value in C2:C7.

Put them together: =INDEX(C2:C7,MATCH(B9,B2:B7,0)) reads as "find where B9 is in B2:B7, then bring back the value at that spot in C2:C7". Like XLOOKUP it can look left, and it works in every version of Excel.

INDEX and MATCH, two stepsA chemist's list with medicines in B2:B7 and prices in C2:C7. Step 1: MATCH(B9,B2:B7,0) finds Omeprazole, the value in B9, at position 4 of the list. Position 4 is row 5, because the list starts on row 2. Step 2: INDEX(C2:C7,4) takes the 4th price in C2:C7, which is 9.99.BC123456789MedicinePrice ($)Aspirin6.49Cetirizine8.99Electrolyte mix5.99Omeprazole9.99Vitamin D37.49Ibuprofen8.29OmeprazolePosition12341 MATCH(B9,B2:B7,0) → 42 INDEX(C2:C7,4) → 9.99
INDEX and MATCH, two steps

Part of Plus

Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.

What INDEX and MATCH does

MATCH tells you where a value sits in a list, as a position number. INDEX brings back whatever is at a given position. Together they make a lookup that can reach any column, left or right.

Give INDEX a whole table and two MATCHes, one for the row and one for the column, and you get a two-way lookup: the value where a row and a column meet, like a room's bookings on one day. It works in every version of Excel and in Google Sheets.

How to write INDEX and MATCH

=INDEX(array, row_num, [column_num])

array
The range to pick from: one column, or a whole table.
row_num
Which row of that range to bring back, counted from its top. Usually a MATCH goes here.
column_num
Optional. Which column of the range, counted from its left edge. You need it when the range has more than one column.

=MATCH(lookup_value, lookup_array, [match_type])

lookup_value
What to find, like a name in a cell.
lookup_array
One row or one column to search.
match_type
Type 0 for an exact match. It is optional, but leaving it out means 1, an approximate match that needs a sorted list.

INDEX and MATCH worked example

A grid shows how many bookings each meeting room has per day. In B9, find the bookings for the room in B7 on the day in B8.

A grid shows how many bookings each meeting room has per day. In B9, find the bookings for the room in B7 on the day in B8.
ABCD
1RoomMonTueWed
2Oak463
3Pine257
4Elm814
5Ash336
6
7RoomPine
8DayWed
9Bookings7
B9=INDEX(B2:D5,MATCH(B7,A2:A5,0),MATCH(B8,B1:D1,0))Find Pine in A2:A5 (row 2) and Wed in B1:D1 (column 3), then bring back where row 2 and column 3 of B2:D5 meet. It shows 7.

Common INDEX and MATCH mistakes

A believable answer from the wrong row

Add 0 as the last part of MATCH. Without it MATCH uses approximate match, which assumes a sorted list and can stop on the wrong item.

The answer is one row off

Start the INDEX range and the MATCH range on the same row, like C2:C7 and B2:B7. If one starts at row 1 and the other at row 2, every position is shifted by one.

An error in a two-way lookup

Point INDEX at the numbers only, like B2:D5, and match against the labels just outside it, A2:A5 and B1:D1. A position bigger than the range has nowhere to land.

INDEX and MATCH or XLOOKUP?

In Microsoft 365, Excel 2021 and later, and Google Sheets, XLOOKUP does a one-way lookup with less typing. Use INDEX and MATCH when the file must work in Excel 2019 or older, where XLOOKUP shows #NAME?, or when you need a two-way lookup in one tidy formula.

Both can look left, which VLOOKUP can't. And both point at the column to bring back, so inserting a column doesn't break them the way it breaks a VLOOKUP column number.

Questions people ask

Is INDEX MATCH better than VLOOKUP?

It's more flexible: it can look left, and it doesn't break when someone inserts a column. It also works in every Excel version.

What does the 0 mean in MATCH?

0 asks for an exact match. Leave it out and MATCH assumes a sorted list, which can return the wrong position.

How do I look up a row and a column at once?

Use one MATCH for the row and one for the column: =INDEX(B2:E10,MATCH(H1,A2:A10,0),MATCH(H2,B1:E1,0)).

Does INDEX MATCH work in Google Sheets?

Yes, in exactly the same way.