toolrota

Excel INDEX and MATCH: do everything VLOOKUP can't

VLOOKUP can't look left and breaks when you insert a column. INDEX and MATCH work in every Excel version and solve both problems.

Serkan Akyürek·Updated ·5 min read
Excel INDEX and MATCH: do everything VLOOKUP can't – Excel

VLOOKUP needs the lookup value in the first column of the table and refers to the result column by number, so inserting a column quietly breaks it. Used together, INDEX and MATCH remove these limits, and they work in older versions of Excel too.

The two functions on their own

MATCH finds the position of a value in a list:

=MATCH("P-104",A2:A100,0)

The 0 in the last argument means exact match. Use it almost every time.

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

=INDEX(C2:C100,5)

This returns the 5th value in C2:C100.

Putting them together

With product codes in column A, prices in column C and the code to find in F2:

=INDEX(C2:C100,MATCH(F2,A2:A100,0))

MATCH finds the row number and INDEX returns the price on that row. Because the result column is selected directly, inserting columns does not break the formula.

Looking up to the left

If product names are in column D, codes in column A, and you want the code for a name:

=INDEX(A2:A100,MATCH(G2,D2:D100,0))

VLOOKUP cannot do this. With INDEX and MATCH, column order does not matter.

Two-way lookup (row and column)

In a monthly sales table, regions are in A3:A10 and months in B2:M2. With the region in J1 and the month in J2:

=INDEX(B3:M10,MATCH(J1,A3:A10,0),MATCH(J2,B2:M2,0))

The first MATCH finds the row, the second the column. The value at the intersection is returned.

Lookup with multiple criteria

Region (B) and product (C) must both match, and the result comes from column D:

=INDEX(D2:D100,MATCH(1,(B2:B100=G1)*(C2:C100=G2),0))

The comparisons produce arrays of TRUE/FALSE values; multiplying them gives 1 only where both conditions are met. Outside Microsoft 365 you may need to confirm the formula with Ctrl + Shift + Enter.

Values that aren't found

If the code is not in the list, you get #N/A. To show a friendly message:

=IFERROR(INDEX(C2:C100,MATCH(F2,A2:A100,0)),"Not found")

VLOOKUP vs INDEX-MATCH vs XLOOKUP

FeatureVLOOKUPINDEX + MATCHXLOOKUP
Look to the leftNoYesYes
Survives inserted columnsNoYesYes
Two-way lookupAwkwardYesBy nesting
Works in older versionsYesYesNo (2021+)

In Microsoft 365, XLOOKUP is shorter to write. If the file will be shared with people on Excel 2016 or 2019, INDEX-MATCH is the safest choice. Newer versions also offer XMATCH, which adds options such as searching from the end.

Common mistakes

  • Forgetting the 0: if the match type is left out, MATCH assumes a sorted list and may return the wrong row.
  • Mismatched ranges: the INDEX and MATCH ranges must start on the same row and have the same length.
  • Numbers vs text: the text "104" does not match the number 104. Keep code columns consistently formatted.

Step-by-step example: looking up to the left and matching on two conditions

Data: A: Order no., B: Customer, C: Product, D: Amount. Finding the amount from the order no. is easy; but finding the amount by the "Customer + Product" combination, or looking left from column D to pull the Customer, can't be done with VLOOKUP.

NeedFormula
Find the customer from the amount (a leftward look)=INDEX(B2:B500,MATCH(E2,D2:D500,0))
Find the amount from the order no.=INDEX(D2:D500,MATCH(E2,A2:A500,0))
Find the amount by Customer + Product (Microsoft 365)=INDEX(D2:D500,MATCH(1,(B2:B500=F2)*(C2:C500=G2),0))
A message if not found=IFERROR(INDEX(...),"No record")
Two-way: by row and column heading=INDEX(B2:E10,MATCH(G1,A2:A10,0),MATCH(G2,B1:E1,0))

In older versions an array-style formula may need to be entered with Ctrl + Shift + Enter; in Microsoft 365 it works directly. For a simpler alternative see our XLOOKUP guide.

MATCH's match types

Third argumentMeaningWhen
0Exact matchRecommended almost always
1Less than or equal (ascending sorted list)Range/band lookups
-1Greater than or equal (descending sorted list)Rare

When INDEX-MATCH instead of VLOOKUP?

  • When you take a value from a column on the left.
  • When the table structure changes often and columns are added and removed (it uses ranges, not column numbers).
  • When performance matters on large tables.
  • When a two-way or multi-condition lookup is needed.

For simple jobs VLOOKUP, or XLOOKUP in new versions, is enough (see our VLOOKUP and XLOOKUP guides).

Frequently asked questions

I get #N/A, why? The value isn't found: spelling, spaces (TRIM), text/number difference; or 1 may have been used instead of 0 in MATCH (see our data cleaning guide).

What does INDEX do alone? It returns the value at a given row/column of the range; MATCH finds the position of that row.

Can it return several results? No; only the first match. Use FILTER for all.

From another sheet or table? Range references are given with the sheet name or table name (Sales[Amount]; see our Excel tables guide).

Slowness? Use the real data range instead of a full-column reference.

Share
Published:
Author
Serkan Akyürek

Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.

Related guides

Excel
Excel4 min read

Split text into columns in Excel: names, addresses, Text to Columns and TEXTSPLIT

"Jane Smith" sits in one cell and you need first and last name separately. Excel has four ways to split text; here is when each one is the right tool.

Excel5 min read

Excel conditional formatting: highlight rows with formulas (10 practical examples)

Overdue invoices in red, sales above target in green. Conditional formatting makes a table readable in seconds, and formula rules let you highlight almost anything.

Excel5 min read

How to find and remove duplicates in Excel: 4 methods

Does the same customer appear three times in your list? Duplicates are the most common cause of wrong reports. Here are four ways to find, highlight and safely remove them.

Excel4 min read

A guide to data cleaning in Excel: 12 steps to make messy data ready for analysis

The quality of analysis depends on the quality of data. Practical, step-by-step ways to clean extra spaces, duplicates, numbers stored as text and broken dates.

Excel4 min read

Forecasting in Excel: how to project sales with TREND, FORECAST and the Forecast Sheet

Excel's TREND, FORECAST and Forecast Sheet are enough to roughly project the future from past data. Setup, interpretation and ways to avoid misleading results.

Office & Productivity5 min read

How to create an automatic table of contents in Word: step by step

Typing your report's table of contents by hand takes time and breaks with every change. Set up Word's automatic table of contents once and forget about it.