XLOOKUP Excel: How It Works and When to Use It

Learn how XLOOKUP works in Excel — syntax, examples, and how it compares to VLOOKUP. Covers basic lookups, left lookups, approximate matching, and common...

XLOOKUP Excel: How It Works and When to Use It

XLOOKUP Excel: How It Works and When to Use It

XLOOKUP is a lookup function in Microsoft Excel that finds a value in one range and returns a corresponding value from another range. Microsoft introduced it in 2019 as a direct replacement for VLOOKUP, HLOOKUP, and INDEX/MATCH. It does what those functions do — with a simpler syntax and fewer limitations that have frustrated Excel users for decades.

The biggest practical difference is that XLOOKUP isn't constrained to searching the leftmost column of a range. With VLOOKUP, your lookup column had to be the first column in your table, which forced users to restructure data or rely on workarounds. XLOOKUP separates the search range from the return range entirely, so you can look up in any column and return from any other column regardless of their positions relative to each other.

XLOOKUP also handles the "not found" case natively. Instead of returning a cryptic #N/A error when no match exists, you can specify a fallback value — a message like "Not found", a zero, or a blank — directly in the function. This eliminates the nested IFERROR wrapping that VLOOKUP users learned as a reflex.

The function is available in Excel 365, Excel 2021, and Excel for the web. It isn't available in Excel 2019, Excel 2016, or earlier versions. If you're sharing workbooks with colleagues on older Excel versions, XLOOKUP will display as a #NAME? error on their end, which matters for compatibility decisions. If your organization standardizes on Excel 365, XLOOKUP is safe to use for everything. Brushing up on the full range of Excel formulas guide alongside XLOOKUP gives you a complete picture of what the modern function library offers.

One thing that surprises users new to XLOOKUP is how much it changes formula maintenance. In large workbooks with many lookup formulas, the traditional VLOOKUP approach creates a fragile dependency on column position. Inserting a column anywhere in the referenced range shifts column numbers without warning, breaking formulas silently — you only discover the breakage when results look wrong.

XLOOKUP's direct column referencing eliminates this fragility entirely. The return_array always points to the specific column you selected, regardless of what happens to neighboring columns. This reliability becomes increasingly valuable as workbooks grow in complexity and more people make changes to the underlying data structure over time.

XLOOKUP is also the first Microsoft lookup function to support spilled results natively. When you ask for a multi-column return, Excel fills adjacent cells automatically without requiring Ctrl+Shift+Enter array entry. This integration with Excel's dynamic array engine means XLOOKUP formulas participate in spill range operations — you can reference the entire spill output using the # operator, which further simplifies downstream formula work.

XLOOKUP Quick Reference
  • Syntax: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
  • Required arguments: lookup_value, lookup_array, return_array
  • Optional arguments: if_not_found, match_mode, search_mode
  • Available in: Excel 365, Excel 2021, Excel Online
  • Not available in: Excel 2019, Excel 2016, and earlier
  • Default match mode: Exact match (0)
  • Default search mode: First-to-last (1)

How to Use XLOOKUP: Step by Step

📋

Identify What You're Looking Up

Determine the value you're searching for — this is your lookup_value. It can be a cell reference (like A2), a typed value in quotes ("Smith"), or a number. Most commonly it's a cell reference so you can copy the formula down a column.
🔍

Select Your Lookup Array

The lookup_array is the range where Excel searches for your value. This is typically one column — the IDs, names, or codes column in your reference table. Select just that column, not the entire table. Example: B2:B100 if IDs are in column B.
↩️

Select Your Return Array

The return_array is the column you want Excel to pull results from. It must be the same height as the lookup_array. Example: if lookup is B2:B100 and you want corresponding email addresses from column D, return_array is D2:D100.
⚠️

Set the Not Found Value (Optional)

The if_not_found argument lets you specify what Excel returns when no match is found. Use "" for a blank, 0 for zero, or a descriptive message like "Not found". If omitted, Excel returns #N/A when there's no match.

Choose Match Mode (Optional)

Match mode controls how Excel matches: 0 = exact match (default), -1 = exact or next smaller, 1 = exact or next larger, 2 = wildcard. For most use cases, leave this argument out and Excel uses exact match.
🔄

Choose Search Mode (Optional)

Search mode controls search direction: 1 = first to last (default), -1 = last to first (useful for finding most recent entries), 2 = binary search ascending, -2 = binary search descending. Binary search mode is significantly faster on well-sorted data with large datasets.
Microsoft Excel - Microsoft Excel certification study resource

XLOOKUP Syntax Explained

The full XLOOKUP syntax is: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]). The three arguments in brackets are optional. In practice, most formulas use the first three or four arguments.

A basic formula looks like: =XLOOKUP(A2, Employees[ID], Employees[Email], "Not found"). This searches for the value in A2 within the ID column of the Employees table and returns the matching email. If no ID matches, it returns "Not found" instead of an error.

What makes XLOOKUP structurally different from VLOOKUP is that the lookup_array and return_array are completely independent. In VLOOKUP, you'd specify the whole table range and then a column number counting from the left — =VLOOKUP(A2, B:F, 4, 0) means "look in B:F, return column 4". Change your table structure by inserting a column and your VLOOKUP column number is wrong. XLOOKUP references specific columns directly, so inserting or deleting columns doesn't break it.

XLOOKUP also supports returning multiple columns in one formula. If your return_array spans multiple columns — for example D2:F100 instead of just D2:D100 — Excel returns all three columns at once using dynamic arrays. This is a significant capability improvement over any single VLOOKUP formula, which could only return one column per formula. Managing large datasets becomes much cleaner when how to merge cells in Excel and range management concepts are well understood alongside XLOOKUP's multi-column return.

Understanding the search_mode argument is underrated by most users who learn XLOOKUP. The default mode searches top-to-bottom, which means it finds the first match in the lookup_array. In many business scenarios, you want the most recent match rather than the oldest — for example, finding the latest transaction for a customer, the most recent price update for a product, or the last recorded status for an order.

Setting search_mode to -1 flips the search direction so XLOOKUP evaluates the lookup_array from bottom to top, returning the last match instead of the first. This eliminates the need for complex array formulas that previously handled "last match" lookups.

The match_mode argument gives XLOOKUP flexibility for approximate lookups. Setting match_mode to -1 (exact or next smaller) is the equivalent of the approximate match VLOOKUP used for tiered calculations — salary bands, tax brackets, discount thresholds. Setting it to 2 enables wildcard matching, where you can use * to match any string. For example, looking up "Smith*" would match "Smith", "Smithson", or "Smithfield" — handling partial-match scenarios cleanly.

XLOOKUP vs VLOOKUP vs INDEX/MATCH

XLOOKUP
  • Can search any column (not just leftmost)
  • Returns multiple columns in one formula
  • Built-in if_not_found argument
  • Works left, right, up, or down
  • Simpler syntax than INDEX/MATCH
  • Requires Excel 365 or 2021
VLOOKUP
  • Searches leftmost column only
  • Returns one column per formula
  • Requires IFERROR wrapper for errors
  • Column index breaks if columns shift
  • Available in all Excel versions
  • Familiar to most Excel users
INDEX/MATCH
  • Can search any column or row
  • Returns one value per formula
  • Requires IFERROR for error handling
  • More complex syntax, harder to read
  • Available in all Excel versions
  • Widely used workaround pre-XLOOKUP

XLOOKUP Examples

Scenario: You have a product table with product IDs in column A and prices in column C. You want to find the price for a given product ID.

Formula: =XLOOKUP(E2, A2:A100, C2:C100, "Not found")

This looks for the value in E2 within A2:A100 and returns the corresponding value from C2:C100. If no match exists, returns "Not found".

Why this beats VLOOKUP: In VLOOKUP you'd write =VLOOKUP(E2, A2:C100, 3, 0) — the 3 means "third column from the left". Add a column between A and C and your formula is wrong. XLOOKUP references C2:C100 directly, so column changes don't affect it.

Excel Spreadsheet - Microsoft Excel certification study resource

When to Use XLOOKUP vs Other Functions

XLOOKUP is the right choice for virtually any new lookup formula in Excel 365 or 2021. The syntax is cleaner than INDEX/MATCH, the left-lookup capability removes the biggest VLOOKUP constraint, and the native error handling is a quality-of-life improvement that matters in practice. For new workbooks shared exclusively among Excel 365 users, XLOOKUP should be your default.

VLOOKUP still makes sense when workbook compatibility with older Excel versions is a requirement. If the spreadsheet will be used by someone on Excel 2016 or 2019, VLOOKUP is safer than XLOOKUP because XLOOKUP will return #NAME? errors in those versions. In those situations, INDEX/MATCH is the better modern alternative when you need capabilities beyond VLOOKUP's rightward search constraint, since INDEX/MATCH works in all Excel versions.

For cleaning data before running any lookup, knowing how to remove duplicates in Excel is essential — duplicate values in the lookup_array cause XLOOKUP to return only the first match, which can produce silent data errors if duplicates exist that shouldn't be there.

XLOOKUP is also the right choice when you need to return multiple columns. A single XLOOKUP formula with a multi-column return_array can replace three separate VLOOKUP formulas pointing at the same table. This not only simplifies the sheet but improves calculation performance since Excel evaluates one lookup instead of three.

Horizontal lookups — where you're searching across a row rather than down a column — work the same way in XLOOKUP. The lookup_array and return_array are simply row ranges instead of column ranges. This is equivalent to HLOOKUP, which XLOOKUP also replaces. Having one consistent function syntax for both vertical and horizontal lookups makes formula writing and auditing significantly easier.

XLOOKUP Checklist: Before You Write the Formula

XLOOKUP Pros and Cons

Pros
  • +Works in any direction — left, right, up, or down
  • +Returns multiple columns in one formula
  • +Built-in if_not_found prevents #N/A errors
  • +More readable syntax than INDEX/MATCH
  • +Doesn't break when columns are inserted or deleted
  • +Supports wildcard matching natively
  • +Supports binary search for large sorted datasets
Cons
  • Only available in Excel 365, 2021, and Online — not in 2019 or earlier
  • Workbooks using XLOOKUP show #NAME? errors when opened in older Excel
  • Still returns only the first match when duplicates exist in lookup_array
  • Learning curve if you're deeply familiar with VLOOKUP patterns
  • Dynamic array spill results can confuse users unfamiliar with Excel 365 features
Excellence Playa Mujeres - Microsoft Excel certification study resource

Common XLOOKUP Errors and How to Fix Them

The #N/A error in XLOOKUP means no match was found in the lookup_array. This happens when the lookup_value doesn't exist in the lookup_array, when there are trailing spaces that make values look identical but not match, or when data types don't match (looking for the number 123 in a column of text "123"). Fix trailing spaces with TRIM() around the lookup_value. Fix data type mismatches by converting text to numbers using VALUE() or by formatting the column consistently.

The #NAME? error means Excel doesn't recognize XLOOKUP as a function — you're on a version that doesn't support it. The fix is either to upgrade to a compatible Excel version or rewrite the formula using INDEX/MATCH or VLOOKUP.

The #VALUE! error usually indicates that lookup_array and return_array are different sizes. XLOOKUP requires them to have the same number of rows (for vertical lookups) or columns (for horizontal lookups). Check both ranges and make them match.

A common logic error is accidentally including a header row in the lookup_array or return_array. If your data starts in row 2 and headers are in row 1, your arrays should be B2:B100 not B1:B100. Including the header row means XLOOKUP might match against header text if someone enters that text as a lookup value, and it skews the row alignment between lookup and return arrays.

When XLOOKUP returns the wrong value even though no error appears, the most common culprit is duplicates in the lookup_array. XLOOKUP always returns the first match. If you need the last match (most recent entry for a customer, latest price update), set search_mode to -1, which searches from the last row to the first. Knowing how to freeze a row in Excel also helps when scrolling through large datasets to verify lookup results visually.

XLOOKUP by the Numbers

2019Year XLOOKUP was introduced in Excel 365
3Required arguments (lookup_value, lookup_array, return_array)
6Total arguments including optional ones
4Search modes available (first-to-last, last-to-first, binary asc/desc)
4Match modes: exact, next smaller, next larger, wildcard
0Extra columns needed for left lookups (vs VLOOKUP workarounds)

XLOOKUP with Tables and Named Ranges

XLOOKUP works especially well with Excel Tables (the structured table format created by Insert → Table or Ctrl+T). When you reference a table column in XLOOKUP — like Employees[Department] — the formula automatically expands as new rows are added to the table. This means you don't have to update range references when data grows, which is one of the most common maintenance tasks in workbooks built on regular range references.

Named ranges are another clean approach. Instead of writing =XLOOKUP(A2, Sheet2!B2:B500, Sheet2!D2:D500), you can define named ranges like "EmployeeIDs" and "EmployeeSalaries" and write =XLOOKUP(A2, EmployeeIDs, EmployeeSalaries). The formula is much easier to read and audit, especially for colleagues who didn't build the workbook.

XLOOKUP also nests cleanly inside other functions. A common pattern is using XLOOKUP as the lookup_value for a second XLOOKUP — this is useful for two-dimensional lookups where you need to find a value at the intersection of a matching row and a matching column. The equivalent in older Excel required an INDEX(MATCH(), MATCH()) construction that many users found difficult to write correctly. XLOOKUP makes the pattern much more readable.

For workbooks where data quality is critical, XLOOKUP pairs well with data validationhow to create a drop down list in Excel so that lookup values entered by users are always constrained to valid options, which eliminates the majority of #N/A errors caused by typos or inconsistent formatting. Combining dropdown validation with XLOOKUP creates robust data entry workflows where lookup failures are nearly impossible.

One advanced application of XLOOKUP is using it to build dynamic lookups where both the lookup value and the return column are variables. Suppose you want users to select both a record identifier and a data field from dropdowns, and have Excel pull the intersection automatically. You can nest XLOOKUP inside another XLOOKUP — the outer XLOOKUP finds the row, the inner XLOOKUP finds the column, and together they return the exact cell at the intersection. This approach replaces OFFSET or INDIRECT-based dynamic range formulas that were harder to read and more error-prone to maintain.

Practical XLOOKUP Tips for Real Work

Lock your lookup_array and return_array references when copying formulas down a column. If your lookup_array is B2:B100 and your return_array is D2:D100, write them as $B$2:$B$100 and $D$2:$D$100 with dollar signs. The lookup_value (A2) should remain relative so it changes as you copy down. Forgetting to lock the arrays is the most common reason XLOOKUP formulas produce wrong results when copied.

Use XLOOKUP's multiple-return capability to consolidate repetitive formulas. If you're pulling three pieces of information from the same table — say, price, category, and supplier — write one XLOOKUP with the return_array spanning three columns instead of three separate formulas. The result spills across three adjacent cells automatically. This reduces formula count, makes the workbook easier to maintain, and slightly improves calculation speed.

When working with case-sensitive data, XLOOKUP uses case-insensitive matching by default. "smith", "Smith", and "SMITH" all match the same lookup entry. If you need case-sensitive matching, you'll need to use a different approach — typically EXACT() combined with an array formula. This is a rare requirement but worth knowing if you're working with data where case differences are meaningful.

For large datasets (tens of thousands of rows), XLOOKUP with search_mode 2 (binary search ascending) is significantly faster than the default first-to-last search. Binary search works by halving the search range repeatedly rather than checking every row sequentially. The requirement is that the lookup_array must be sorted in ascending order for binary search to return correct results. For sorted reference tables, this is a worthwhile performance setting.

XLOOKUP also interacts cleanly with conditional formatting and data validation. If you use XLOOKUP results as the basis for conditional formatting rules — highlighting rows where the lookup returns a specific value, for example — the formula evaluates dynamically as data changes, so the formatting stays accurate without manual updates. In dashboards and reporting templates that refresh regularly with new data, this combination makes the output far more maintainable than static approaches that require manual formatting review after every data update.

When auditing a workbook you didn't build, finding all XLOOKUP formulas is straightforward using Ctrl+F with the search term "XLOOKUP". Review each formula's lookup_array and return_array references to confirm they point to the correct ranges. Check whether the if_not_found argument is set — blank if_not_found combined with lookup failures produces #N/A errors that surface unexpectedly in summary calculations. A few minutes of XLOOKUP audit work during handoff saves hours of troubleshooting after the original builder is no longer available to answer questions.

Excel XLOOKUP Questions and Answers

About the Author

James R. HargroveJD, LLM

Attorney & Bar Exam Preparation Specialist

Yale Law School

James R. Hargrove is a practicing attorney and legal educator with a Juris Doctor from Yale Law School and an LLM in Constitutional Law. With over a decade of experience coaching bar exam candidates across multiple jurisdictions, he specializes in MBE strategy, state-specific essay preparation, and multistate performance test techniques.