How to Use XLOOKUP in Excel: Formula, Examples and Common Errors

Diagram explaining the XLOOKUP formula in Excel: lookup value, lookup array, return array and the optional if not found argument

The Solo Toolbox · Software Help for One-Person Businesses

XLOOKUP in Excel finds a value in one range and returns the matching value from another. The basic formula is =XLOOKUP(lookup_value, lookup_array, return_array), for example =XLOOKUP(A2, Clients[ID], Clients[Email]) to find a client’s email by ID. Unlike VLOOKUP, it can look to the left, defaults to an exact match, and won’t break when someone inserts a column.

Before you start

  • Works in: Excel for Microsoft 365, Excel 2021 and 2024, Excel for the web, and Excel on iPhone, iPad and Android. Google Sheets has it too.
  • Doesn’t work in: Excel 2019 and older. Files shared with someone on those versions will show #NAME?.
  • Tip: convert your data to a table with Ctrl+T so formulas use readable names like Clients[Email] and grow automatically.

The XLOOKUP syntax, explained

XLOOKUP has three required arguments and three optional ones:

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

ArgumentWhat it means
lookup_valueWhat you’re searching for (an ID, name, SKU)
lookup_arrayThe column or row to search in
return_arrayThe column or row to return a value from
if_not_found (optional)What to show when there’s no match, such as “Not found”
match_mode (optional)0 exact match (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard
search_mode (optional)1 first to last (default), -1 last to first, 2 and -2 binary search on sorted data

The lookup array and return array must be the same size. If one is A2:A100 and the other is C2:C99, you’ll get a #VALUE! error.

Example 1: A basic exact-match lookup

You have an invoice list with invoice numbers in column A and amounts in column D. To find the amount for the invoice number typed in G2:

=XLOOKUP(G2, A2:A500, D2:D500)

No need to count columns or add FALSE at the end, which are the two most common VLOOKUP mistakes.

Example 2: Show a friendly message instead of #N/A

Add the fourth argument:

=XLOOKUP(G2, A2:A500, D2:D500, "Invoice not found")

This replaces the old IFERROR(VLOOKUP(...)) pattern and only catches the not-found case, so genuine errors elsewhere in the formula still show up.

Example 3: Look up to the left

VLOOKUP can only return values to the right of the lookup column. XLOOKUP doesn’t care about direction. If client names are in column C and client IDs are in column A, you can find an ID from a name:

=XLOOKUP("Northwind Design", C2:C200, A2:A200)

Example 4: Return a whole row of data

If the return array spans several columns, XLOOKUP returns all of them and spills the results into neighboring cells:

=XLOOKUP(G2, A2:A500, B2:E500)

One formula fills in the client, date, status and amount for an invoice. Make sure the cells to the right are empty, or you’ll get a #SPILL! error.

Example 5: Find the most recent entry

Set search_mode to -1 to search from the bottom up. In a payment log sorted by date, this returns the latest payment from a client:

=XLOOKUP("Northwind Design", B2:B1000, D2:D1000, "No payments", 0, -1)

This is one of XLOOKUP’s most useful tricks and was awkward to do with VLOOKUP or INDEX/MATCH.

Example 6: Tiered pricing or tax brackets

For a rate table where column A holds minimum quantities (0, 100, 500, 1,000) and column B holds the price per unit, use match_mode -1 to find the matching tier:

=XLOOKUP(G2, A2:A5, B2:B5, , -1)

An order of 640 units returns the 500-unit price. Note the empty fourth argument: you still need the comma to skip it.

Example 7: Two-way lookup

To find a value at the intersection of a row and a column, for example hours worked by a specific person in a specific month, nest one XLOOKUP inside another:

=XLOOKUP("Maria", A2:A20, XLOOKUP("March", B1:M1, B2:M20))

The inner XLOOKUP returns the entire March column; the outer one picks Maria’s row from it.

Wildcard matches

Set match_mode to 2 to use wildcards: * matches any characters and ? matches a single character. To find the first client whose name contains “Studio”:

=XLOOKUP("*Studio*", C2:C200, A2:A200, "None", 2)

How to fix common XLOOKUP errors

ErrorLikely causeFix
#N/ANo match found: extra spaces, numbers stored as text, typosUse TRIM on the source data, convert text-numbers with VALUE, or add if_not_found
#VALUE!Lookup and return arrays are different sizesMake both ranges cover the same rows
#NAME?Excel version doesn’t support XLOOKUP, or a typo in the function nameCheck the version; use INDEX/MATCH for older Excel
#SPILL!A multi-column result is blocked by data in neighboring cellsClear the cells the result needs to spill into

The “numbers stored as text” problem catches almost everyone eventually. IDs exported from accounting tools or CRMs often arrive as text, while the IDs you type are numbers. A small green triangle in the corner of the cell is the giveaway.

XLOOKUP vs VLOOKUP vs INDEX/MATCH

XLOOKUPVLOOKUPINDEX/MATCH
Look leftYesNoYes
Default matchExactApproximateSet by you
Survives inserted columnsYesNoYes
Built-in not-found messageYesNoNo
Works in Excel 2019 and olderNoYesYes

If everyone who opens your workbook uses Microsoft 365 or Excel 2021 or later, use XLOOKUP. If you send spreadsheets to clients on older versions, stick with INDEX/MATCH so the formulas don’t break on their end. When you share a workbook with clients, our guide to sharing an Excel file as view-only keeps them from accidentally overwriting your formulas.

Make XLOOKUP formulas easier to maintain

Three habits keep lookup formulas from breaking months later. First, turn source data into an Excel table (Ctrl+T) and refer to columns by name, such as Invoices[Amount], so new rows are included automatically and the formula explains itself. Second, avoid whole-column references like A:A in large workbooks; they work, but they slow down recalculation on big files. Third, put the lookup value in its own cell rather than typing it into the formula, so you can change what you’re searching for without editing the formula.

XLOOKUP in Google Sheets

Google Sheets supports XLOOKUP with the same arguments, so formulas carry over when you move a spreadsheet between Excel and Sheets. The main difference is that Sheets doesn’t have Excel’s structured table references in the same form, so you’ll use ordinary ranges like A2:A500 instead of table names.

Frequently asked questions

Is XLOOKUP better than VLOOKUP?

For most work, yes: it’s safer by default and more flexible. VLOOKUP’s only advantage is compatibility with old Excel versions.

Can XLOOKUP search across sheets?

Yes. Reference the other sheet in the arrays, for example =XLOOKUP(A2, Clients!A:A, Clients!D:D).

Is XLOOKUP case-sensitive?

No. “ACME” and “acme” match. For a case-sensitive lookup, combine XLOOKUP with EXACT: =XLOOKUP(TRUE, EXACT(A2:A100, G2), B2:B100).

Related guides

Sources

Get smarter software tips in your inbox

Clear tutorials, honest software recommendations, productivity tips and the tech updates that matter to one-person businesses.

Free. We’ll email you a link to confirm. Unsubscribe anytime with one click. We never share your address. Privacy policy

Get smarter software tips in your inbox

Free. Confirm by email, unsubscribe anytime. Privacy policy

Similar Posts