Skip to content

XLOOKUP

XLOOKUP finds a value and returns the matching entry from any column, even to the left. Learn the syntax, the optional arguments and typical mistakes, then practice.

  • Free, no sign-up
  • No upload – files stay on your device
  • Phone, tablet and computer
Loading the spreadsheet …

XLOOKUP searches one column for a value and returns the matching entry from another column. Unlike older lookup functions, it can look to the left, it uses an exact match by default, and it has a built-in fallback for values that aren’t found. Try it above with a staff list: extension, employee ID, a missing name and a PTO policy.

XLOOKUP syntax

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

Argument Meaning
lookup_value What you’re looking for, e.g. a name in G2
lookup_array The column to search, e.g. the names in B2:B13
return_array The column with the result, e.g. the extensions in D2:D13; same number of rows as the lookup array
if_not_found Optional: what to show instead of #N/A, e.g. "not found"
match_mode Optional: 0 exact (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcards
search_mode Optional: 1 from top to bottom (default), -1 from bottom to top

Example from the practice sheet: =XLOOKUP(G2,B2:B13,D2:D13) finds “Lauren Bennett” in the names and returns her extension, 410.

Practice right here

Fill in the green cells and click Check. The four tasks build on each other:

  1. Return the extension for the name in G2.
  2. Return the employee ID, which sits to the left of the names.
  3. Show “not found” for a name that isn’t on the list.
  4. Find the PTO days for 7 years of service with match mode -1.

If your result is wrong, the check tells you why, for example when the return array points to the wrong column.

Three things XLOOKUP does better

Looking to the left

Lookup array and return array are separate ranges, so the result column can be anywhere, including to the left of the search column: =XLOOKUP(G2,B2:B13,A2:A13) returns the employee ID from column A. With VLOOKUP, the search column always has to come first.

Exact match by default

You don’t need a FALSE at the end. Without a match mode, XLOOKUP only returns exact matches. For tiers, set the match mode: with -1, 7 years of service fall into the “from 5 years” tier.

Built-in error handling

The fourth argument replaces IFERROR: =XLOOKUP(G6,B2:B13,C2:C13,"not found"). To use match mode without a fallback, leave the fourth argument empty: =XLOOKUP(G9,I2:I5,J2:J5,,-1).

Common mistakes

  • #VALUE!: the lookup array and return array have different sizes, such as B2:B13 and D2:D12.
  • #N/A: the value isn’t in the lookup array. Check spelling and extra spaces, or add a fallback as the fourth argument.
  • Wrong tier: match mode 1 returns the next larger value, -1 the next smaller one. For “from X years” tiers you need -1.
  • #NAME? in another program: Excel 2019 and earlier don’t know XLOOKUP. If you share the file, use VLOOKUP or INDEX and MATCH instead.
Note: In Microsoft 365, the return array may span several columns, such as C2:D13, and Excel then fills the neighboring cells. The Spreadsheet Editor only shows the first value in that case, so write one formula per result.

Frequently asked questions

Which Excel versions support XLOOKUP?

Microsoft 365, Excel 2021 and later, and Excel for the web. Excel 2019 and older versions show #NAME?. The practice sheet on this page supports it in any current browser.

Can XLOOKUP search from the bottom up?

Yes. Set the sixth argument, search_mode, to -1. That way you get the last match, for example the most recent order of a customer.

Can I use wildcards?

Yes, with match mode 2. Then "Lau*" finds the first name that starts with “Lau”.

Is XLOOKUP slower than older lookup functions?

For everyday tables you won’t notice a difference. Choose the function that’s easier to read and that works in the program your colleagues use.

Microsoft Excel is a trademark of Microsoft Corporation. The Spreadsheet Editor is not affiliated with Microsoft.