Productivity

XLOOKUP vs VLOOKUP: Which Lookup Formula Should You Use?

Lookup formulas find a value in one column and return a match from another. Learn how VLOOKUP and XLOOKUP differ, with worked examples and the mistakes to avoid.

A screen showing a spreadsheet with rows of book titles and prices
Photo: ASC Leiden - Rwanda 2021 - 037 - Screen shot of a spreadsheet for books with their price - Kigali.jpg by Gerard van de Bruinhorst, CC BY-SA 4.0, via Wikimedia Commons.
Key points
  • XLOOKUP can return a value from a column on either side of the lookup column
  • XLOOKUP defaults to an exact match, which avoids a common VLOOKUP error
  • XLOOKUP is not available in Excel 2016 or 2019
  • In VLOOKUP, use FALSE for exact match

A lookup formula answers questions like "what is the price of this product code?" or "which department does this employee work in?" You give it a value, it finds that value in a column, and it returns something from the same row. Spreadsheet users have used VLOOKUP for decades. Newer versions of Excel add XLOOKUP, which fixes several of its quirks.

The problem lookups solve

Imagine a price list with product codes in column A and prices in column C, and an order sheet where you type a code and want the price to appear. Without a lookup you would copy prices by hand, and mistakes would creep in. A lookup formula pulls the right price automatically, and updates when the list changes.

VLOOKUP in brief

Google's help page for VLOOKUP describes it as a way to search for related information by row when you know some information. The syntax, from Google's page, is:

=VLOOKUP(search_key, range, index, [is_sorted])

  • search_key is the value to find in the first column of the range.
  • range is the block of cells to search.
  • index is the number of the column in the range that holds the answer (the first column is 1).
  • is_sorted controls matching. Google's page says FALSE gives an exact match and is recommended, and TRUE gives an approximate match and is the default if you leave it out. It warns that for an approximate match you should sort the search column in ascending order first, or you may get a wrong return value.

An example from Google's page is =VLOOKUP(G9, B4:D8, 3, FALSE): look for the value in G9 in the first column of B4:D8, and return the value from the third column of that range, requiring an exact match.

Where VLOOKUP trips people up

  • The lookup column must be the first column of the range. You cannot look up in column C and return something from column A.
  • The index number is fragile. If you insert a column in the table, the number may point at the wrong column.
  • The default match can be approximate. If you forget the final FALSE, you can get a plausible but wrong answer. This is the most common VLOOKUP bug.

XLOOKUP in brief

Microsoft's page says you can use XLOOKUP to find things in a table or range by row, with an example of looking up a part price by part number. It adds that you can look in one column for a search term and return a result from the same row in another column, regardless of which side the return column is on.

The syntax from Microsoft's page:

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

  • lookup_value is what you search for.
  • lookup_array is the column or row to search.
  • return_array is the column or row to return from.
  • if_not_found is optional text to show when nothing matches. If you omit it, XLOOKUP returns #N/A.
  • match_mode is optional. The default, 0, is an exact match. Other settings find the next smaller or larger item, or allow wildcards.
  • search_mode is optional and lets you search from the last item backwards, or use a binary search on sorted data.

An example: =XLOOKUP(E2, A2:A100, C2:C100, "Not found") looks for the code in E2 in the range A2:A100, returns the matching price from C2:C100, and shows "Not found" if the code is missing.

Side-by-side

Feature VLOOKUP XLOOKUP
Lookup column position Must be leftmost in the range Any column, returns from any column
Default match Approximate if you omit the last argument (per Google's page) Exact (per Microsoft's page)
Not found message #N/A unless wrapped in another function Built-in if_not_found argument
Column reference A number you must keep updated A range, so inserting columns is safe
Availability Excel, Google Sheets, and others Microsoft says it is not available in Excel 2016 or 2019. It is listed for Excel 2021, 2024, Microsoft 365 and Excel for the web.

Which should you use?

  • Use XLOOKUP if everyone who uses the file has a version of Excel that supports it. It is safer and easier to read.
  • Use VLOOKUP if the file will be opened in Excel 2016 or 2019, or by people you cannot check. Always write FALSE as the last argument.
  • In Google Sheets, check the help pages for the lookup functions available in your version. Google's VLOOKUP page documents VLOOKUP, and it also lists a tip about XLOOKUP in a different Google product.

If you are sharing a workbook, remember Microsoft's own warning: you may encounter a workbook in Excel 2016 or 2019 that contains XLOOKUP, created by someone using a newer version. In that case the formula may not work.

Common mistakes

  • Trailing spaces and different formats. "A100" and "A100 " are different to a spreadsheet. Numbers stored as text fail to match numbers. Clean the data first.
  • Duplicates. Both functions return the first match. If your list has duplicate codes, the answer may not be the one you wanted.
  • Moving the lookup range. Lock the range with dollar signs (for example $A$2:$A$100) so it does not shift when you copy the formula down.
  • Wrapping errors. Use if_not_found in XLOOKUP, or IFERROR with VLOOKUP, to show a friendly message, but do not hide real errors by accident.

Practice exercise

  1. Create a small price list with product codes, names and prices.
  2. On another sheet, type a code and write a lookup formula to return the name.
  3. Change the formula to return the price.
  4. Type a code that does not exist, and see what appears.
  5. Insert a column in the price list and see whether the formula still works.

For summing data based on conditions rather than finding one value, see our guide to SUMIFS.

The short version

XLOOKUP is easier and safer where you can use it. VLOOKUP still works everywhere, as long as you remember to ask for an exact match. Keep your data clean and your ranges locked.

Sources and further reading

  1. Microsoft Support, XLOOKUP function
  2. Google Docs Editors Help, VLOOKUP
  3. Microsoft Support, SUMIFS function

How this page was made: drafted with the help of an AI writing assistant, then checked against the sources above. Software menus and policies change, so check the linked pages for the current version. Read our editorial policy or report a mistake.

A

A.Agaag
Editor and site owner at ArcClear. ArcClear publishes practical guides on everyday software, devices and online safety, and links to the official documentation behind each claim.