XLOOKUP Excel: Syntax, Examples, and Why It Beats VLOOKUP

XLOOKUP Excel guide with syntax, exact-match and wildcard examples, common errors, and when to use it instead of VLOOKUP or INDEX/MATCH.

Bob · Former McKinsey and Deloitte consultant with 6 years of experienceMay 9, 20268 min read

XLOOKUP Excel is the lookup formula most analysts should learn first. It fixes the two VLOOKUP problems that waste the most time: left-to-right limits and wrong-match defaults.

For this guide, we reviewed the top 5 Google results for "xlookup excel" on May 9, 2026, checked 4 current Microsoft support pages plus 2 research sources, and mapped 9 common lookup jobs against XLOOKUP, VLOOKUP, and INDEX/MATCH. Most ranking pages cover syntax and one toy example. The bigger gaps are version limits, multi-column returns, missing-value handling, and where AI helps without hiding the workbook logic.

This guide covers the syntax, the examples that matter in business workbooks, and when a workbook tool such as Deckary becomes more useful than another one-cell formula.

If you need to...Use this patternWhy it is better
Return one exact match=XLOOKUP(A2,IDs,Owners)Exact match is the default
Show a custom missing-value message=XLOOKUP(A2,IDs,Owners,"Not found")Cleaner than wrapping everything in IFERROR
Look left=XLOOKUP(A2,IDs,Names)No table-array restriction
Return multiple columns=XLOOKUP(A2,IDs,Budget:Actual)One formula can spill several columns
Find the last matching value=XLOOKUP(A2,IDs,Status,"",0,-1)Reverse search is built in
Use a threshold table=XLOOKUP(B2,Bands,Rates,"",-1)Better approximate-match control

XLOOKUP Excel quick reference infographic

What XLOOKUP Excel Does#

XLOOKUP Excel searches one range or array and returns a matching value from another range or array in the same row or column. Microsoft's XLOOKUP function documentation says you can search in one column and return from another regardless of which side the return column is on.

Version support matters before you rewrite a model. Microsoft's support page lists XLOOKUP for Microsoft 365, Excel 2021, Excel 2024, Mac, and web versions, and separately notes that the function is not available in Excel 2016 or Excel 2019.

XLOOKUP Excel Syntax and the Six Arguments#

XLOOKUP Excel syntax is:

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

Microsoft's XLOOKUP page says the function returns the first match it finds, and if you do not specify a match mode, exact match is the default.

ArgumentWhat it meansMost common analyst use
lookup_valueThe value you want to findEmployee ID, SKU, account code, month
lookup_arrayThe range to searchThe column or row containing the key
return_arrayThe range to return fromOwner, price, department, metric
if_not_foundCustom output when no match exists"Not found" or ""
match_modeExact, approximate, or wildcard behaviorUsually leave blank or use -1, 1, or 2 when needed
search_modeSearch orderLeave blank for first-to-last or use -1 for last-to-first

Most business formulas only need the first 3 or 4 arguments. Reach for match_mode or search_mode only when you need thresholds, wildcard text matching, or the last matching row.

How to Use XLOOKUP Excel for Exact Match, Left Lookup, and Multiple Returns#

XLOOKUP Excel is easiest to learn through three patterns: exact match, left lookup, and multi-column return.

Suppose A2 contains an employee ID, H:H contains IDs, and J:J contains manager names:

=XLOOKUP(A2,$H$2:$H$20,$J$2:$J$20,"Not found")

That formula searches the ID list and returns the manager name from the same row. There is no column-number counting step.

If the ID is in column J and the name is in column H, the formula still works:

=XLOOKUP(A2,$J$2:$J$20,$H$2:$H$20,"Not found")

Microsoft's lookup guidance says XLOOKUP and XMATCH are improved versions of older lookup functions because they work in any direction and return exact matches by default.

Microsoft also shows that one XLOOKUP formula can return multiple adjacent columns. If B:D contains Name, Department, and Region, you can use:

=XLOOKUP(A2,$H$2:$H$20,$B$2:$D$20,"Not found")

That spills the returned values across columns, which is useful for reporting tabs where one lookup should populate several fields.

ScenarioFormula patternWhy it helps
Owner by ID=XLOOKUP(A2,IDs,Owners,"Not found")Clean exact match
Name from a right-side key=XLOOKUP(A2,IDs,Names)Left lookup without INDEX/MATCH
Return name, department, and region=XLOOKUP(A2,IDs,Details,"Not found")One formula, several outputs
Blank instead of #N/A=XLOOKUP(A2,IDs,Owners,"")Cleaner user-facing sheet

If your lookup pattern still relies on legacy formulas, read VLOOKUP Excel. If you want the broader formula shortlist, Excel Formulas is the better hub.

Build and audit Excel workbooks with AI

Describe the model, cleanup, audit, or output sheet you need. Deckary's AI Excel agent works through the task inside your workbook.

XLOOKUP Excel vs VLOOKUP and INDEX MATCH#

XLOOKUP Excel is the better default for new workbooks, but VLOOKUP and INDEX/MATCH still matter in legacy files.

Microsoft's lookup support page says XLOOKUP works in any direction and returns exact matches by default. Microsoft's VLOOKUP documentation still shows that leaving the fourth argument blank allows approximate matching, which is why inherited models can return wrong answers without throwing errors.

DimensionXLOOKUPVLOOKUPINDEX + MATCH
Exact match by defaultYesNoOnly if you set MATCH(...,0)
Can look leftYesNoYes
Return several columns at onceYesNoNot as clean
Built-in missing-value messageYesNoNo
Works in older Excel versionsNoYesYes
Best use nowNew workbooks in modern ExcelInherited legacy modelsBackward-compatible advanced lookups

Use this rule:

  1. Use XLOOKUP for new work in Microsoft 365, Excel 2021, or Excel 2024.
  2. Keep VLOOKUP when you are maintaining a legacy file that other users open in Excel 2016 or Excel 2019.
  3. Use INDEX/MATCH when you need backward-compatible left lookups or when the workbook already uses that pattern heavily.

How to Use XLOOKUP for Approximate Match, Wildcards, and Last Match#

Most XLOOKUP tutorials stop after the exact-match example. The three advanced patterns below save more time in real workbooks.

PatternFormula patternBest use
Next smaller match=XLOOKUP(B2,$M$2:$M$8,$N$2:$N$8,"",-1)Rate cards, tax bands, commission tables
Wildcard match=XLOOKUP("*"&A2&"*",$H$2:$H$20,$J$2:$J$20,"Not found",2)Partial text search
Last match=XLOOKUP(A2,$H$2:$H$200,$J$2:$J$200,"",0,-1)Latest status or last repeated value

Microsoft's match_mode documentation says -1 returns the next smaller item, 1 returns the next larger item, and 2 enables wildcard matching with *, ?, and ~. Microsoft also says search_mode=-1 starts from the last item and searches upward.

Common XLOOKUP Errors and Limits#

XLOOKUP failures usually come from workbook conditions, not the syntax itself.

SymptomLikely causeFix
#N/ANo valid match and no if_not_found argumentAdd if_not_found, then inspect the source key
Wrong result from an approximate lookupThreshold table is unsorted or wrong match modeRecheck the sort order and match_mode
No formula autocompleteExcel version does not support XLOOKUPConfirm the user is on Microsoft 365, Excel 2021, or Excel 2024
Missing match that should existText-number mismatch or hidden spacesAlign data types and clean the source
Spill problem on multi-column returnNeighboring cells are not emptyClear the destination range before using a multi-column return

Binary search deserves one warning. Microsoft says search_mode values 2 and -2 rely on the lookup array being sorted, and invalid results will be returned if it is not.

When AI Helps With XLOOKUP#

Microsoft and LinkedIn's 2024 Work Trend Index surveyed 31,000 knowledge workers across 31 markets and found that 75% use AI at work. The 2023 paper InstructExcel: A Benchmark for Natural Language Instruction in Excel introduced a benchmark with over 10,000 samples, 170-plus Excel operations, and 2,000 public spreadsheets, showing that spreadsheet instruction following is still hard for strong models.

Use AI to draft an XLOOKUP, rewrite a VLOOKUP, or explain why one set of rows fails while another works. If the real task is "write 300 lookups across tabs, create an output sheet, and verify mismatches," Deckary is a better fit because it can work inside the workbook and check the result. For adjacent workflows, read Best AI for Excel, ChatGPT for Excel, and How to Use Copilot in Excel.

Summary#

  1. XLOOKUP is the best default lookup formula in modern Excel.
  2. It is safer than VLOOKUP because exact match is the default and left lookup works natively.
  3. if_not_found, wildcard mode, approximate match, and reverse search solve most advanced cases.
  4. AI can draft and explain lookup formulas, but workbook-wide jobs need a tool that can verify the result inside the file.

Sources#

Build and audit Excel workbooks with AI

Describe the model, cleanup, audit, or output sheet you need. Deckary's AI Excel agent works through the task inside your workbook.

XLOOKUP Excel: Syntax, Examples, and Why It Beats VLOOKUP | Deckary