INDEX and MATCH in Excel: The Lookup Combo Explained

INDEX and MATCH is a lookup technique that works in every version of Excel. It can look left, it doesn’t break when you insert columns, and it can do two-way lookups. Before XLOOKUP existed, it was the professional’s choice.

The trick is to understand each function on its own first. Then combining them is easy.

Step 1: What INDEX does

INDEX returns the value at a given position in a range.

=INDEX(range, row_number)

Using this list in B2:B6:

RowCode (A)Product (B)Price (C)
1P100Keyboard15
2P101Mouse8
3P102Monitor120
4P103USB Cable3
5P104Headset25
=INDEX(B2:B6, 3)

returns Monitor, the 3rd item in the range.

Step 2: What MATCH does

MATCH does the opposite. It finds a value and tells you its position.

=MATCH(lookup_value, range, 0)
=MATCH("P102", A2:A6, 0)

returns 3, because P102 is the 3rd item. The 0 means exact match. Always include it.

Step 3: Put them together

MATCH finds the row number, and INDEX uses it to return the value:

=INDEX(C2:C6, MATCH(E2, A2:A6, 0))

Read it as: “give me the price from C2:C6, at the position where E2 appears in A2:A6.” If E2 is P102, the result is 120.

Looking to the left

This is where INDEX/MATCH beats VLOOKUP. To find a product’s code from its name, just swap the ranges:

=INDEX(A2:A6, MATCH(E2, B2:B6, 0))

If E2 is “Mouse”, the result is P101. VLOOKUP can’t do this because the code column is to the left of the name.

Two-way lookup (row and column)

INDEX can also take a column number. Combine it with two MATCH functions to look up a value by both row and column, like sales for a specific region and month.

RegionJanFebMar
North1,2001,3501,500
South9001,1001,050
East1,4001,2501,600

With the table in A1:D4, region in G2 and month in H2:

=INDEX(B2:D4, MATCH(G2, A2:A4, 0), MATCH(H2, B1:D1, 0))

For “South” and “Feb”, the result is 1,100.

Lock your ranges

Before copying the formula down, press F4 to add $ signs to the ranges:

=INDEX($C$2:$C$6, MATCH(E2, $A$2:$A$6, 0))

Handling missing values

If the value isn’t found, MATCH returns #N/A. Wrap the formula in IFNA:

=IFNA(INDEX($C$2:$C$6, MATCH(E2, $A$2:$A$6, 0)), "Not found")

Common mistakes

  • Forgetting the 0 in MATCH. Without it, MATCH uses approximate match and may return the wrong row.
  • Ranges of different sizes. The INDEX range and MATCH range must start on the same row and have the same number of rows.
  • Extra spaces or text numbers. These cause #N/A, just like VLOOKUP. See how to convert numbers stored as text.

INDEX/MATCH vs VLOOKUP vs XLOOKUP

VLOOKUPINDEX/MATCHXLOOKUP
Look leftNoYesYes
Safe when inserting columnsNoYesYes
Two-way lookupNoYesYes (nested)
Works in all Excel versionsYesYesNo (365/2021+)
Easy to readYesMediumYes

If you have Excel 365, XLOOKUP is simpler. If you need your file to work in older versions, INDEX/MATCH gives you the same power. Compare all three in XLOOKUP vs VLOOKUP.

Leave a Comment