If you work with spreadsheets, you have almost certainly used VLOOKUP — and if you're on a
recent version of Excel, you've probably seen XLOOKUP suggested as the "better" replacement.
But better how, exactly? And is it always true?
This guide compares both functions side by side, with real formulas, a practical example, and
the common errors each one produces — so you can decide which one actually belongs in your
workbook.
What Is VLOOKUP in Excel?
VLOOKUP ("Vertical Lookup") searches for a value in the first column of a range and returns
a value from a specified column in the same row.
Syntax:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
lookup_value— the value you're searching fortable_array— the range that contains your datacol_index_num— the column number (counting from the left) to return a value fromrange_lookup—FALSEfor an exact match,TRUEfor an approximate match
Example:
=VLOOKUP("EMP-103", A2:B100, 2, FALSE)
This looks for "EMP-103" in column A and returns the matching value from column B.
VLOOKUP has been part of Excel since the early 1990s, which is exactly why it still shows up in
almost every workbook, template, and job interview question involving spreadsheets.
What Is XLOOKUP in Excel?
XLOOKUP is a newer, more flexible lookup function introduced in Excel 365 and Excel 2021. It
replaces VLOOKUP, HLOOKUP, and INDEX/MATCH in most use cases.
Syntax:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
lookup_value— the value you're searching forlookup_array— the column (or row) to searchreturn_array— the column (or row) to return a value fromif_not_found— an optional custom message instead of#N/Amatch_mode/search_mode— optional controls for exact, approximate, or wildcard matching, and search direction
Example:
=XLOOKUP("EMP-103", A2:A100, B2:B100, "Not found")
Note that XLOOKUP is only available in Excel 365, Excel 2021, Excel for the web, and Excel
2024+. If you're on Excel 2019 or earlier, XLOOKUP will not work, and VLOOKUP is still your
option.
VLOOKUP vs XLOOKUP: Key Differences at a Glance
| Feature | VLOOKUP | XLOOKUP |
|---|---|---|
| Search direction | Left to right only | Left, right, up, or down |
| Lookup column position | Must be the first column in the range | Can be anywhere |
| Default match type | Approximate match (easy to get wrong) | Exact match (safer default) |
| Custom "not found" message | Not built in — requires IFERROR |
Built in (if_not_found argument) |
| Column-insert safety | Breaks if you insert/delete a column (col_index_num shifts) |
Unaffected — references whole columns, not a position number |
| Can return multiple values at once | No | Yes (spills across cells) |
| Search from the last match | Not supported | Supported (search_mode = -1) |
| Excel version required | All versions | Excel 365 / 2021 / 2024 / Excel for the web only |
When Should You Use VLOOKUP?
- You're working in Excel 2019 or earlier, where XLOOKUP doesn't exist
- You're editing a file that will be shared with people on older Excel versions
- You're maintaining an existing workbook that already uses VLOOKUP throughout
- You just need a quick, simple left-to-right lookup and don't want to change habits
When Should You Use XLOOKUP?
- You're on Excel 365, Excel 2021, Excel 2024, or Excel for the web
- Your lookup column is not the leftmost column in your data
- You want built-in error handling without wrapping every formula in
IFERROR - You're building a workbook that will have columns inserted or reordered later
- You want a single formula that can replace both VLOOKUP and HLOOKUP
Step-by-Step Example: Looking Up Employee Department Data
Suppose you manage HR data for JKDA Analytics Systems, and you have a table of employee IDs
and their departments:
| Employee ID | Department |
|---|---|
| EMP-101 | Sales |
| EMP-102 | Finance |
| EMP-103 | Engineering |
| EMP-104 | Marketing |
You want to look up the department for EMP-103.
Using VLOOKUP
=VLOOKUP("EMP-103", A2:B5, 2, FALSE)
This returns Engineering. If someone later inserts a new column between Employee ID and
Department, the 2 becomes incorrect, and the formula silently returns the wrong value.
Using XLOOKUP
=XLOOKUP("EMP-103", A2:A5, B2:B5, "Employee not found")
This also returns Engineering — but because the formula references the actual Department
column directly (B2:B5) instead of a column number, it keeps working correctly even if
columns are inserted or reordered. It also returns a clear message instead of #N/A if the
employee ID doesn't exist.
Common Errors and How to Fix Them
The #N/A Error
Both functions return #N/A when the lookup value isn't found. Common causes:
- Extra spaces in the lookup value or source data (fix with
TRIM) - Mismatched data types — a number stored as text vs. an actual number
- The lookup value genuinely doesn't exist in the range
Fix: Wrap VLOOKUP in IFERROR, or use XLOOKUP's built-in if_not_found argument.
The #REF! Error (VLOOKUP Only)
This happens when col_index_num points past the last column of your table_array — usually
after a column was deleted.
Fix: This is exactly the failure mode XLOOKUP avoids, since it references the return column
directly instead of counting columns by position.
Frequently Asked Questions
Is XLOOKUP always better than VLOOKUP?
Not always — it's more robust and flexible, but it's only available on newer Excel versions. If
your file needs to work on Excel 2019 or earlier, VLOOKUP is still the right choice.
Can XLOOKUP look to the left of the lookup column?
Yes. Unlike VLOOKUP, XLOOKUP's lookup_array and return_array can be in any position relative
to each other — left, right, or non-adjacent.
Does XLOOKUP replace INDEX/MATCH?
In most everyday cases, yes. XLOOKUP was designed to cover the same flexibility as INDEX/MATCH
with simpler syntax, though INDEX/MATCH still has some advanced use cases (like dynamic column
selection) where it remains useful.
Will my VLOOKUP formulas stop working if I upgrade to a newer Excel?
No. VLOOKUP is not deprecated — it still works in every current Excel version, including those
that also support XLOOKUP.
Which one should I learn first?
If you're new to lookups, learning VLOOKUP first is still useful because it's everywhere in
existing workbooks, templates, and job descriptions. But once you're comfortable with it, XLOOKUP
is worth learning next for any file you're building from scratch.
Conclusion
VLOOKUP and XLOOKUP solve the same basic problem — finding a value and returning related data
from the same row — but they do it differently. VLOOKUP is simple, universally compatible, and
still perfectly valid for straightforward lookups. XLOOKUP is more flexible, safer against
accidental column changes, and has cleaner error handling, but it only works on newer Excel
versions.
If you're building something new in a modern version of Excel, XLOOKUP is generally the better
default. If compatibility with older files or older Excel versions matters, VLOOKUP remains a
dependable choice. Either way, understanding both — and knowing exactly when to reach for each
one — is what actually makes you fast and accurate in Excel.