QlearnAIStart free

XLOOKUP vs VLOOKUP: The Difference and Which One to Use

By the QlearnAI team · Updated

Use XLOOKUP if your Excel has it: it looks for an exact match by default, can look left as well as right, and lets you set what to show when nothing is found. VLOOKUP looks for an approximate match unless you add FALSE, and it can only search the first column of a table and return a column to its right. XLOOKUP is in Microsoft 365, Excel 2021, Excel 2024, Excel for the web and Google Sheets, but not in Excel 2016 or 2019. Learn VLOOKUP well enough to read and fix it, because older files are full of it.

What is the difference between XLOOKUP and VLOOKUP?

Both find a value in one column and bring back a value from the same row. The difference is how you tell them where to look and what they do by default. Here are the two signatures, from the Microsoft Support pages for XLOOKUP and VLOOKUP:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
XLOOKUPVLOOKUP
Default matchExact (match_mode 0)Approximate (range_lookup TRUE)
Where it searchesAny column you point it atOnly the first column of table_array
What it returnsA separate return_array, left or right of the search columnA column counted from the left (col_index_num)
Return several columns at onceYesNo, one column per formula
When nothing is foundReturns if_not_found, or #N/A if you left it out#N/A
Search from the bottomYes, search_mode -1No
Needs sorted dataOnly for binary search (search_mode 2 or -2)Yes, for its default approximate match
Available inMicrosoft 365, Excel 2021 and 2024, Excel for the web and mobile, Google SheetsEvery version of Excel

Microsoft's own VLOOKUP page suggests trying XLOOKUP instead, calling it an improved version of VLOOKUP.

How do I use XLOOKUP?

Give it three things: what to find, the column to search, and the column to bring back. The examples below use a small menu from a café, the same kind of sheet used in our free Excel course. Put it in A1:C6:

ABC
1ItemCategoryUnit cost
2EspressoCoffee0.60
3LatteCoffee0.90
4ChaiTea0.70
5CroissantFood1.10
6SandwichFood3.20

To find what a Latte costs:

=XLOOKUP("Latte", A2:A6, C2:C6)

Result: 0.90. XLOOKUP searches A2:A6, finds Latte in the second position, and returns the second value from C2:C6. In a real sheet you'd point at a cell, such as =XLOOKUP(E2, $A$2:$A$6, $C$2:$C$6), and the dollar signs keep the ranges fixed when you fill the formula down.

Show a message instead of #N/A

There's no Mocha on the menu, so this returns #N/A:

=XLOOKUP("Mocha", A2:A6, C2:C6)

Add the fourth argument, if_not_found, to show something clearer:

=XLOOKUP("Mocha", A2:A6, C2:C6, "Not on menu")

Result: Not on menu.

Look to the left

VLOOKUP can't do this. To find which item costs 3.20, search column C and return column A:

=XLOOKUP(3.2, C2:C6, A2:A6)

Result: Sandwich.

Return two columns at once

In Excel, a return range that spans several columns gives back several values, which spill into the cells to the right:

=XLOOKUP("Chai", A2:A6, B2:C6)

Result: Tea in the formula cell and 0.70 next to it. Leave those neighbouring cells empty, or the formula can't spill.

Find the last match, not the first

search_mode controls the direction. The default, 1, searches from the top; -1 searches from the bottom. Take a short sales log in E1:G5:

EFG
1DateItemQty
22026-03-02Latte8
32026-03-03Espresso6
42026-03-07Latte12
52026-03-12Espresso5
=XLOOKUP("Latte", F2:F5, G2:G5)
=XLOOKUP("Latte", F2:F5, G2:G5, "None", 0, -1)

The first returns 8, the first Latte sale. The second returns 12, the most recent one. The 0 keeps exact match; you have to fill in match_mode to reach search_mode.

match_mode has four values: 0 for exact match (the default), -1 for exact or the next smaller item, 1 for exact or the next larger item, and 2 for wildcards, where *, ? and ~ have special meaning. search_mode also accepts 2 and -2 for a binary search, which needs data sorted ascending or descending; on unsorted data it returns wrong results.

How do I write the same lookup with VLOOKUP?

=VLOOKUP("Latte", A2:C6, 3, FALSE)

Result: 0.90. VLOOKUP searches the first column of A2:C6 and returns the third column, Unit cost. The FALSE asks for an exact match.

Leave out FALSE and VLOOKUP uses approximate match, which assumes the first column is sorted. This menu isn't sorted, so =VLOOKUP("Latte", A2:C6, 3) can return a cost from the wrong row or #N/A, with no warning.

Two more limits follow from the syntax. The 3 is a fixed position, so if someone inserts a column inside A:C, the formula may start returning the wrong column. And if col_index_num is larger than the number of columns in table_array, you get #REF!.

Does XLOOKUP work in my Excel version or in Google Sheets?

XLOOKUP is in Excel for Microsoft 365 (Windows, Mac and web), Excel 2024, Excel 2021, and the Excel apps for iPad, iPhone and Android. Microsoft's page notes that XLOOKUP isn't available in Excel 2016 or Excel 2019. If you share files with people on those versions, use VLOOKUP.

Google Sheets has XLOOKUP too. The argument names differ (search_key, lookup_range, result_range, missing_value), but the order is the same, the default match_mode is 0 (exact) and the default search_mode is 1. Every formula above that returns a single value works the same way in Sheets.

Why does my VLOOKUP return #N/A?

#N/A means the lookup didn't find a match. Microsoft's guide to correcting #N/A lists the usual causes:

CauseHow to fix it
The value really isn't in the listCheck the spelling, or show a message with if_not_found (XLOOKUP) or IFERROR (VLOOKUP)
Approximate match on unsorted dataAdd FALSE as the fourth VLOOKUP argument, or switch to XLOOKUP
A number looked up in text-formatted cells, or the reverseMake both columns the same type, both numbers or both text
Extra spaces before or after the textRemove them, for example with TRIM
With approximate match, the value is smaller than the smallest in the first columnCheck the value, or use exact match

For VLOOKUP, also check that the value you're searching for sits in the first column of table_array. If it's in the second column, VLOOKUP never looks there. Be careful with IFERROR: it hides every error, including real mistakes, so fix the cause first and add the message last.

Should I still learn VLOOKUP?

Yes, enough to read and repair it. Files built before XLOOKUP existed use VLOOKUP everywhere, and Excel 2016 and 2019 don't have XLOOKUP. For new work in Microsoft 365, Excel 2021 or later, or Google Sheets, write XLOOKUP.

Our free course, Excel Basics: Formulas, XLOOKUP and Pivot Tables, teaches lookups on one café sales sheet, alongside SUMIFS, tables and pivot tables. You write each formula, check it against an expected result, and fix #N/A and #REF! along the way. It works in Excel or Google Sheets.

Frequently asked questions

Is XLOOKUP better than VLOOKUP?

For most new formulas, yes. It defaults to exact match, can look left, can return several columns and has a built-in message for missing values. VLOOKUP's advantage is that it works in every Excel version, including 2016 and 2019.

What is the default match type in XLOOKUP and VLOOKUP?

XLOOKUP defaults to exact match (match_mode 0). VLOOKUP defaults to approximate match (range_lookup TRUE), so add FALSE as the fourth argument when you want an exact match.

Can XLOOKUP look to the left?

Yes. The search range and the return range are separate, so the return column can be on either side. VLOOKUP can only return columns to the right of its first column.

Is XLOOKUP available in Excel 2016 or 2019?

No. Microsoft says XLOOKUP isn't available in Excel 2016 or 2019. It's in Microsoft 365, Excel 2021, Excel 2024, Excel for the web and the mobile apps.

Does Google Sheets have XLOOKUP?

Yes. Google Sheets has XLOOKUP with the same argument order. Its default match is exact and its default search runs from first to last, like Excel.

How do I stop XLOOKUP showing #N/A?

Fill in the fourth argument, if_not_found, for example =XLOOKUP(E2, A2:A6, C2:C6, "Not found"). If the value is missing, the formula shows your text instead of #N/A.

Why does my VLOOKUP return the wrong value without an error?

Usually because the fourth argument is missing, so VLOOKUP uses approximate match on a column that isn't sorted. Add FALSE, or rewrite the formula with XLOOKUP.