Short answer: use XLOOKUP if your Excel has it (Microsoft 365, Excel 2021 or later, and Excel for the web). Use INDEX with MATCH if the file must also open in older versions. Use VLOOKUP only for quick jobs where the answer column is to the right of the key and nobody will insert columns later.
The sample table
A lookup formula finds a key (such as a product code) in one column and returns a matching value from the same row. Here is a small price list in cells A1:C6, which every example below uses.
| A: Code | B: Product | C: Price |
|---|---|---|
| P101 | Notebook | 250 |
| P102 | Marker pack | 480 |
| P103 | Desk lamp | 1,900 |
| P104 | File folder | 120 |
| P105 | Stapler | 350 |
Suppose a sales sheet has the code P103 in cell E2, and you want the price in F2. The correct answer is 1,900.
VLOOKUP: the classic
=VLOOKUP(E2, $A$2:$C$6, 3, FALSE)
Read it as: find E2 in the first column of A2:C6, then return the value from the third column. The final FALSE means exact match. If you leave it out, Excel assumes an approximate match, which needs a sorted first column and can return a wrong row without any warning. This is the most common VLOOKUP mistake.
VLOOKUP has two structural limits. It can only look to the right of the key column, and the result column is counted as a number (3 above). If someone inserts a new column inside the table, that number may point at the wrong column even though the formula still shows no error.
XLOOKUP: the modern replacement
=XLOOKUP(E2, $A$2:$A$6, $C$2:$C$6, "Not found")
You name the column to search and the column to return as two separate ranges. Because there is no column number, inserting a column does not break it. Exact match is the default, and the fourth argument lets you show friendly text instead of #N/A. It can also look to the left, so finding a code from a product name is easy:
=XLOOKUP("Stapler", $B$2:$B$6, $A$2:$A$6) returns P105.
Two extras are worth knowing. Setting the match mode lets you find the next smaller value, which suits tax slabs or commission bands. And you can return more than one column at once, for example =XLOOKUP(E2, $A$2:$A$6, $B$2:$C$6), which spills the product and the price into neighbouring cells in versions that support dynamic arrays.
INDEX and MATCH: works everywhere
=INDEX($C$2:$C$6, MATCH(E2, $A$2:$A$6, 0))
MATCH finds the position of the key in the code column (P103 is position 3). INDEX then returns the third item from the price column. The 0 at the end of MATCH means exact match. This pair has no left-only restriction and has worked in every Excel version for years, so it is the safe choice when a file is shared with people on older software.
Side-by-side comparison
| Feature | VLOOKUP | XLOOKUP | INDEX + MATCH |
|---|---|---|---|
| Looks left of the key | No | Yes | Yes |
| Survives inserted columns | No (column number) | Yes | Yes |
| Default match | Approximate | Exact | You choose (use 0) |
| Built-in "not found" text | No, wrap in IFERROR | Yes | No, wrap in IFERROR |
| Older Excel versions | Yes | Not in Excel 2019 or earlier | Yes |
| Ease for beginners | Easiest to read | Easy | Needs two functions |
Fixing #N/A when you know the value exists
- Hidden spaces. "P103 " with a trailing space is not the same as "P103". Wrap the key in
TRIM, for exampleTRIM(E2), or clean the source column. - Numbers stored as text. A code typed as 1001 in one sheet and "1001" (text, often left-aligned with a green corner mark) in another will not match. Convert both to the same type.
- Range not locked. If you copy the formula down and the table range moves, rows near the bottom fall outside the table. Use dollar signs, as in
$A$2:$C$6, or an Excel Table. - Wrong match type. A VLOOKUP without
FALSEon an unsorted list is a common cause of wrong results rather than errors. - Genuinely missing. Sometimes the code simply is not in the list. Show "Not found" so the gap is visible instead of hiding it with a blank.
If you do not want to write the formula by hand, the Excel Formula Generator builds common lookups from plain-language inputs. For data that arrives as a PDF table, convert it first with PDF to Excel, then check the result before relying on it.
Questions people ask
Is VLOOKUP going away?
Microsoft still documents VLOOKUP and has not announced removal, and existing files keep working. XLOOKUP is simply the more flexible option for new work.
Which is fastest?
On normal business files of a few thousand rows, the difference is not noticeable. Choose by reliability and compatibility, not speed.
Can a lookup return more than one match?
These three formulas return the first match only. To list every match you need a filter-style approach, for example the FILTER function in versions that support it, or a PivotTable.
What is the safest habit?
Always ask for an exact match, lock the table range, and show "Not found" for missing keys so you notice them.
References
- Microsoft Support: XLOOKUP function
- Microsoft Support: VLOOKUP function
- Microsoft Support: INDEX function
Last reviewed: 2 December 2026. Written for GM Tools Hub under the editorial policy.