Excel · Lookups

INDEX + MATCH & XLOOKUP: fixing VLOOKUP's limits

The follow-up to "explain VLOOKUP" is almost always "what are its limitations, and what would you use instead?" This lesson is that answer.

Your win todayLook up a value that sits to the left of the key, three ways, and say which one you'd choose and why.

Split the job in two

VLOOKUP does "find" and "fetch" in one go, and that's why it's rigid. INDEX and MATCH each do one half:[MS]

MATCH: value → position

=MATCH("Meera", B2:B6, 0) → 3
"Meera is the 3rd item." The last argument 0 means exact match. Like VLOOKUP, the default (1) is approximate.

INDEX: position → value

=INDEX(A2:A6, 3) → E103
"Give me the 3rd item of this range." Takes any range, on either side.
A · EmpID B · Name E101E102E103E104E105 AshaRaviMeeraJohnFatima 12345 ① MATCH("Meera", B2:B6, 0) searches column B → returns 3 ② INDEX(A2:A6, 3) fetches row 3 of column A → E103 =INDEX(A2:A6, MATCH("Meera", B2:B6, 0)) → E103 The return column (A) sits LEFT of the key column (B). VLOOKUP can't do this.
MATCH answers "which row?", and INDEX answers "what's in that row of this other column?". The two ranges only need the same height. They can sit in any order.

Why interviewers like INDEX+MATCH

  1. Looks in any direction. The return column can be left of the key.
  2. Survives inserted columns. You point at the column itself, not a hard-coded "3", so inserting a column doesn't break it.
  3. Two-way lookup. Add a second MATCH for the column:
    =INDEX(B2:D6, MATCH("E104", A2:A6, 0), MATCH("Dept", B1:D1, 0)) → Sales

XLOOKUP: the modern one-function version

=XLOOKUP( lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode] )

=XLOOKUP("Meera", B2:B6, A2:A6, "Not found")   → E103

The comparison table interviewers want

VLOOKUPINDEX + MATCHXLOOKUP
Look left?❌✅✅
Default matchApproximateApproximate (MATCH's default is 1)Exact
Safe if a column is inserted?❌ hard-coded index✅✅
Not-found handlingWrap in IFERRORWrap in IFERRORBuilt-in argument
Last match?❌Awkward✅ search_mode -1
Works in Excel 2016/2019?✅✅❌
Say it in the interview"MATCH returns the position of a value, and INDEX returns the value at a position. Nesting them lets MATCH find the row and INDEX fetch it from any column. So it can look left, and it doesn't break when columns are inserted. On Microsoft 365 I'd use XLOOKUP: exact match by default, any direction, and a built-in not-found value. On older Excel I fall back to INDEX-MATCH."

Retrieval check

What does =MATCH("Ravi", B2:B6, 0) return?

Inside INDEX(…, MATCH(…)), what does MATCH supply?

What is XLOOKUP's default match mode?

The client runs Excel 2016 and needs a left lookup. What do you use?

Someone inserts a column in the middle of your table. What happens to INDEX+MATCH?

Type it

G2 holds a name. Return that person's EmpID with INDEX + MATCH.

Do the same with XLOOKUP, showing "Not found" if the name is missing.

Your turn

Go deeper

Primary source: Microsoft Support: XLOOKUP function. Read the syntax table and the "match_mode / search_mode" rows. Then Look up values with VLOOKUP, INDEX, or MATCH.

Related: Lesson 1: VLOOKUP · Lesson 3: Pivots & IFERROR · Excel cheat sheet

💬 Ask your teacher. Try: "give me 5 more INDEX-MATCH practice questions" or "when would VLOOKUP still be fine?"