Menu

INDEX MATCH in Excel: Lookup Left, Two-Way, Any Version

=INDEX(C2:C6,MATCH(F2,A2:A6,0)) finds the row of F2 in column A and returns the value from that row of column C. It looks left, does two-way lookups and works in every Excel version.

Every sheet on this page is live: change a number or a formula and it recalculates.

=INDEX(C2:C6,MATCH(F2,A2:A6,0)) finds the row where F2 appears in A2:A6 and returns the value from the same row of C2:C6. MATCH finds the position, INDEX fetches the value at that position. It works in every version of Excel, and it can look to the left.

Price of a product
G2
ABCDEFG
1ProductCategoryPriceCodeLook forPrice
2AppleFruit$1.20P-101Pear$1.50
3PearFruit$1.50P-102
4CarrotVegetable$0.80P-205
5BreadBakery$2.40P-310
6MilkDairy$1.10P-412
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Change F2 to Milk and G2 returns $1.10. Change C2:C6 to B2:B6 and it returns the category instead.

How INDEX and MATCH work together

The formula is two steps in one cell. Here they are in separate cells, so you can see what each part returns.

The two steps, one per cell
G3
ABCDEFG
1ProductCategoryPriceCodeLook forBread
2AppleFruit$1.20P-101Position4
3PearFruit$1.50P-102Price$2.40
4CarrotVegetable$0.80P-205
5BreadBakery$2.40P-310
6MilkDairy$1.10P-412
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

MATCH(G1,A2:A6,0) returns 4, because Bread is the fourth item of A2:A6. INDEX(C2:C6,4) returns the fourth item of C2:C6, $2.40. Put the MATCH inside the INDEX in place of G2 and you have the one-cell formula. Two rules make it work:

  • The two ranges must start on the same row and have the same height. MATCH(...,A2:A6,0) counts from row 2, so INDEX must read C2:C6, not C1:C6 (which would return the row above).
  • End MATCH with 0. Without it MATCH does an approximate match that assumes column A is sorted, and on a list of names it can return the position of the wrong row. The MATCH page covers its three match types.

If the value is not in the list, MATCH returns #N/A and so does the whole formula. =IFNA(INDEX(C2:C6,MATCH(F2,A2:A6,0)),"Not found") shows text instead.

Lookup to the left

VLOOKUP returns columns to the right of the one it searches. INDEX and MATCH do not care about the order: search column D, return column A.

Product name from its code
G2
ABCDEFG
1ProductCategoryPriceCodeCodeProduct
2AppleFruit$1.20P-101P-310Bread
3PearFruit$1.50P-102
4CarrotVegetable$0.80P-205
5BreadBakery$2.40P-310
6MilkDairy$1.10P-412
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

P-310 returns Bread. Type P-205 in F2 for Carrot. With VLOOKUP you would have to move the Code column to the front of the table first.

Two-way lookup: INDEX with two MATCHes

INDEX takes a row number and a column number. Give it a whole table and let one MATCH find the row and another find the column.

Sales by region and month
B8
ABCD
1RegionJanFebMar
2North4,2003,9004,800
3South3,1003,6003,300
4East5,2004,7005,600
5West2,8003,0003,400
6RegionEast
7MonthMar
8Sales5,600
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

East is row 3 of A2:A5 and Mar is column 3 of B1:D1, so INDEX returns row 3, column 3 of B2:D5: 5,600. The row MATCH searches down the first column, the column MATCH searches across the header row, and both ranges line up with the table B2:D5.

Why INDEX MATCH beats VLOOKUP

=VLOOKUP(F2, A2:D6, 3, FALSE)
=INDEX(C2:C6, MATCH(F2, A2:A6, 0))

Both return the price. The difference shows up when the sheet changes:

  • Inserting a column. Insert a column between Category and Price, and the VLOOKUP still asks for column 3, which is now the new empty column. Excel adjusts C2:C6 in the INDEX version to D2:D6 and it keeps working.
  • Looking left. Shown above: VLOOKUP cannot, INDEX MATCH can.

In Excel 2021 and Microsoft 365, XLOOKUP does both in one function with simpler arguments. INDEX MATCH is still the choice for files that have to open in Excel 2019 or older, and the INDEX part is useful on its own. For lookups on two conditions at once, see lookup with multiple criteria.

Practice: look to the left

Stock export
G2
ABCDEFG
1CodePriceStockProductLook forPrice
2P-101$1.2040AppleMilk
3P-102$1.5025Pear
4P-205$0.8060Carrot
5P-310$2.4015Bread
6P-412$1.1030Milk
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: The product names are in the last column. In G2, return the price of the product in F2 with INDEX and MATCH.

Practice: a two-way lookup

Test scores
B9
ABCD
1StudentMathScienceArt
2Ana788592
3Ben647188
4Cara958973
5Dev826779
6
7StudentCara
8SubjectScience
9Score
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: In B9, return the score of the student in B7 for the subject in B8.

Frequently Asked Questions

How does INDEX MATCH work?

MATCH finds the position of a value in a column, and INDEX returns the value at that position in another column. In =INDEX(C2:C6,MATCH("Pear",A2:A6,0)), MATCH returns 2 because Pear is the second item of A2:A6, and INDEX returns the second item of C2:C6.

Why use INDEX MATCH instead of VLOOKUP?

It can return a column to the left of the one it searches, and it does not break when a column is inserted inside the table (there is no column number to go stale). In Excel 2021 and Microsoft 365, XLOOKUP gives the same advantages in one function.

What does the 0 in MATCH mean?

It asks for an exact match. Without it MATCH uses match_type 1, an approximate match that expects the column to be sorted ascending, and on an unsorted list it can return the position of the wrong row.

How do I do a two-way lookup with INDEX MATCH?

Give INDEX a whole table and two MATCHes, one for the row and one for the column: =INDEX(B2:D5,MATCH("South",A2:A5,0),MATCH("Feb",B1:D1,0)) returns the value where the South row meets the Feb column.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED