Leila Gharani next to the word XLOOKUP, a magnifying glass and the Excel logo

Get the XLOOKUP Practice Workbook

Follow along with the file from the video and try every XLOOKUP example yourself. Free download.

Why Use XLOOKUP Instead of VLOOKUP?

VLOOKUP has been Excel’s default lookup function since 1985, but it has four limitations that cause frequent errors:

  • It only searches right. The lookup column must be the leftmost column in your table. If the return value is to the left, VLOOKUP cannot reach it.
  • It uses a column index number. If you insert or delete a column, that number shifts and returns wrong data silently.
  • It defaults to approximate match. Forgetting to add FALSE as the fourth argument returns incorrect results without warning.
  • It requires sorted data for approximate matches. If the table is not sorted in ascending order, VLOOKUP can return the wrong value.

XLOOKUP fixes all four issues. It searches in any direction, uses a separate return range (no column numbers), defaults to exact match, and handles unsorted data for approximate matches. It also includes a built-in if_not_found argument, so you do not need to wrap it in IFERROR.

Want a head-to-head walkthrough on the same dataset? Our full XLOOKUP vs VLOOKUP comparison shows what each function returns side by side, including how they behave when columns get inserted or moved.

Availability: XLOOKUP works in Microsoft 365, Excel 2021+, Excel for the web, and Google Sheets. It is not available in Excel 2019 or earlier.

How Does XLOOKUP Work? (Setup and Data)

To follow the examples below, we will use a dataset of employee records with names, divisions, departments, and start dates. This data is on a sheet called “MD” (Master Data).

Master Data sheet showing employee names, divisions, departments, and start dates in Excel

We want to look up an employee name and return the Division they were assigned to. The results go in Column C.

Lookup sheet with employee names in column A and empty Division column C for XLOOKUP results

We also want to calculate a bonus based on Yearly Salary (Column B) using a bonus tier table.

Yearly Salary column and empty Bonus column for approximate match XLOOKUP example

The calculations for the Bonus are based on the following table.

Bonus tier lookup table showing salary thresholds and corresponding bonus percentages

XLOOKUP Syntax and Arguments Explained

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

The first three arguments are required. The last three are optional.

Required arguments:

  • lookup_value — the value you are searching for. Can be text, a number, or a cell reference.
  • lookup_array — the range or column to search in. Must be a single row or column.
  • return_array — the range to return a value from. Must have the same number of rows (or columns) as the lookup_array. Can span multiple columns to return several values at once.

Optional arguments:

  • if_not_found — a custom value to display when no match exists. Without this, XLOOKUP returns #N/A on a failed lookup. Example: “Not found” or 0.
  • match_mode — controls how XLOOKUP matches values:
    • 0 (default) = exact match
    • -1 = exact match or next smaller value
    • 1 = exact match or next larger value
    • 2 = wildcard match (supports *, ?, ~)
    • 3 = regex match (Excel 365 only, added December 2024)
  • search_mode — controls the search direction:
    • 1 (default) = first to last
    • -1 = last to first (returns last match)
    • 2 = binary search, ascending (data must be sorted A-Z)
    • -2 = binary search, descending (data must be sorted Z-A)

In most cases, you only need the first three arguments. XLOOKUP defaults to exact match searched top to bottom, which is the most common lookup scenario.

How to Do an Exact Match Lookup with XLOOKUP

Select the first empty cell under the Division heading and enter:

=XLOOKUP(A5, MD!$D$5:$D$37, MD!$B$5:$B$37)
XLOOKUP formula in cell C5 looking up employee name from Master Data sheet in Excel

How this formula works:

  • A5 — the employee name to search for.
  • MD!$D$5:$D$37 — the Name column on the Master Data sheet (the lookup_array).
  • MD!$B$5:$B$37 — the Division column on the Master Data sheet (the return_array).

The dollar signs lock the lookup and return ranges so they stay fixed when you copy the formula down. If you prefer to skip absolute references, convert your data to an Excel Table and use structured references instead.

XLOOKUP defaults to exact match (match_mode 0), so you do not need to specify FALSE like you do with VLOOKUP.

Copy the formula down to see results for all employees.

XLOOKUP results showing Division for each employee name filled down in Excel

Notice that the return column (Division, column B) is to the left of the lookup column (Name, column D). VLOOKUP cannot do this. XLOOKUP handles left lookups natively.

Excel data highlighting that XLOOKUP return column is to the left of the search column

How to Return the Last Match with XLOOKUP

By default, XLOOKUP returns the first match it finds (searching top to bottom). But what if a name appears more than once?

In our data, “Kim West” has two records. She was originally in the Utility division and later transferred to Game.

XLOOKUP result showing Kim West matched to Utility division as first occurrence
Master Data sheet showing Kim West appearing twice with two different divisions

To return the last match (Kim’s current division), set the search_mode to -1:

=XLOOKUP(A5, MD!$D$5:$D$37, MD!$B$5:$B$37, "Not Found", 0, -1)
XLOOKUP formula with search mode -1 to find last match for Kim West in Excel

The three optional arguments here:

  • “Not Found” — displays this text if the name does not exist.
  • 0 — exact match (the default, included here because we need to reach the sixth argument).
  • -1 — search from last to first, so XLOOKUP stops at the most recent record.
Excel results showing Kim West original Division as Utility and current Division as Game

Kim West started in Utility but currently works in Game. The reverse search found her most recent record.

How to Use XLOOKUP for Approximate Match (Next Smaller)

Not every lookup has an exact match in the data. Salary-based bonus tiers, tax brackets, and shipping rate tables all use ranges. You need to find the closest value without going over.

Employee list with Yearly Salary column and empty Bonus column for XLOOKUP calculation
Bonus tier table with salary thresholds and bonus percentages for approximate match lookup

Enter this formula to find the bonus tier for each employee’s salary:

=XLOOKUP(B5, MD!$G$5:$G$9, MD!$H$5:$H$9, "Not Found", -1)
XLOOKUP approximate match formula with match mode -1 for next smaller value in Excel

The -1 in the match_mode argument means “exact match or next smaller item.”

Kim West earns 60,200. The closest threshold without going over is 60,000, so the formula returns 10%.

XLOOKUP results showing correct bonus percentages for each employee based on salary tiers

Does XLOOKUP Require Sorted Data?

No. This is one of the biggest upgrades over VLOOKUP. VLOOKUP’s approximate match (TRUE or 1) requires the lookup column to be sorted in ascending order.

If it is not sorted, VLOOKUP returns wrong results without any error.

XLOOKUP’s approximate match works regardless of sort order.

Bonus tier table sorted in ascending order returning correct XLOOKUP results
Same bonus tier table in random order still returning correct XLOOKUP results

The table above is scrambled, and XLOOKUP still returns the correct bonus. VLOOKUP would fail here.

How to Use XLOOKUP with Wildcards (Partial Match)

When you do not know the full lookup value, use wildcard characters to match partial text. Set match_mode to 2:

   =XLOOKUP("*West*", MD!$D$5:$D$37, MD!$B$5:$B$37, "Not found", 2)

This matches any name containing “West” anywhere in the cell. The wildcard characters are:

  • * (asterisk) — matches any number of characters. “Kim*” matches “Kim West” and “Kimberly”.
  • ? (question mark) — matches exactly one character. “?im” matches “Kim” and “Tim” but not “Jim Bob”.
  • ~ (tilde) — escapes a wildcard. “~*” matches a literal asterisk.

To make the formula dynamic, concatenate a cell reference with the wildcard:

=XLOOKUP(E2&"*", MD!$D$5:$D$37, MD!$B$5:$B$37, "Not found", 2)

If E2 contains “Kim”, this matches any name starting with “Kim”.

Important: Wildcard match mode (2) is case-insensitive. “kim” matches “Kim” and “KIM”. If you need case-sensitive matching, use regex match mode (3) instead.

How to Look Up with Multiple Criteria in XLOOKUP

XLOOKUP accepts a single lookup_value, but you can combine multiple conditions using two approaches.

Method 1: Concatenation

Join the lookup values and lookup arrays with &:

=XLOOKUP(E2&F2, A2:A100&B2:B100, C2:C100, "Not found")

If E2 contains “Game” and F2 contains “Kim West”, the formula searches for the combined text “GameKim West” in the combined array of columns A and B. When it finds a match, it returns the value from column C.

Method 2: Boolean array (1/0 lookup)

Multiply conditions to create an array of 1s and 0s, then search for 1:

=XLOOKUP(1, (A2:A100=E2)*(B2:B100=F2), C2:C100, "Not found")

Each condition produces TRUE/FALSE. Multiplying converts them to 1/0. A row that passes both tests equals 1. XLOOKUP finds the first 1 and returns the corresponding value from column C.

The boolean method is more flexible for complex conditions (greater than, less than, contains) and avoids text-type mismatches that can trip up concatenation.

How to Do a Two-Way Lookup with Nested XLOOKUP

A two-way lookup finds a value at the intersection of a specific row and column. Nest one XLOOKUP inside another:

=XLOOKUP(E2, B6:B17, XLOOKUP(E3, C5:G5, C6:G17))

The inner XLOOKUP searches the header row (C5:G5) for the column label in E3 and returns the entire matching column from the data range C6:G17.

The outer XLOOKUP then searches column B for the row label in E2 and returns the intersecting value.

This replaces the classic INDEX+MATCH+MATCH two-way lookup with a cleaner formula.

How to Use XLOOKUP with Regex (Match Mode 3)

In December 2024, Microsoft added regex support to XLOOKUP in Excel 365. Set match_mode to 3 and provide a regex pattern as the lookup_value:

=XLOOKUP("Game|Utility", A2:A100, B2:B100, "Not found", 3)

The | operator means OR, so this matches the first cell containing either “Game” or “Utility”.

This is useful for fuzzy matching when the same entity has different spellings in your data (e.g., “USA”, “United States”, “US”).

More regex pattern examples:

  • “^Kim” — matches names that start with “Kim”.
  • “West$” — matches names that end with “West”.
  • “(?i)game” — case-insensitive match for “game” (regex is case-sensitive by default).

Version note: Regex match mode 3 is only available in Microsoft 365 (Excel for Windows and Mac). It is not available in Excel 2021 or earlier. If you need partial matching in older versions, use wildcard match mode 2 instead.

XLOOKUP Errors and How to Fix Them

  • #N/A — No match found. Check for typos, extra spaces (use TRIM), or mismatched data types (text vs. number). Add an if_not_found argument to suppress: =XLOOKUP(A5, D5:D37, B5:B37, “Not found”)
  • #VALUE! — The lookup_array and return_array have different sizes. Both must have the same number of rows (or columns for horizontal lookups).
  • #NAME? — XLOOKUP is not recognized. This happens in Excel 2019 or earlier where the function does not exist. Upgrade to Excel 2021/365 or use VLOOKUP/INDEX+MATCH.
  • #SPILL! — When returning multiple columns, the output cells are not empty. Clear the cells where results need to spill.
  • Wrong result with no error — Usually caused by approximate match on unsorted data in VLOOKUP. XLOOKUP does not have this problem unless you use binary search (search_mode 2 or -2) on unsorted data.

XLOOKUP vs VLOOKUP vs INDEX MATCH: Which Should You Use?

FeatureXLOOKUPVLOOKUPINDEX+MATCH
Look up to the leftYesNoYes
Default match typeExactApproximateExact (with 0)
Built-in error handlingYes (if_not_found)No (needs IFERROR)No (needs IFERROR)
Breaks when columns insertedNoYes (column index shifts)No
Return last matchYes (search_mode -1)NoPossible but complex
Wildcard supportYes (match_mode 2)Yes (with FALSE/exact match)Yes (in MATCH)
Regex supportYes (match_mode 3, 365 only)NoNo
Works in Excel 2019 and earlierNoYesYes

Bottom line: Use XLOOKUP if everyone accessing your file has Excel 2021 or Microsoft 365. Use INDEX+MATCH if you need the same flexibility but must support older versions. Use VLOOKUP only for simple right-direction lookups in legacy files.

For a detailed side-by-side walkthrough, see XLOOKUP vs VLOOKUP: Which Should You Use?

Want to master XLOOKUP, FILTER, UNIQUE, and other modern functions? Check out the Modern Excel Functions course.

Frequently Asked Questions

Is XLOOKUP available in Excel 2019?

No. XLOOKUP requires Microsoft 365, Excel 2021, or Excel for the web. In Excel 2019 and earlier, the formula returns a #NAME? error. Use VLOOKUP or INDEX+MATCH instead.

Can XLOOKUP return multiple values?

Yes. Set the return_array to span multiple columns. For example, =XLOOKUP(A5, D5:D37, B5:C37) returns values from both column B and column C for the matching row. The results spill into adjacent cells.

To return multiple rows (all matches, not just the first), use the FILTER function. For a full breakdown of the four ways to return multiple match values in Excel, including INDEX+AGGREGATE for older versions and GROUPBY+ARRAYTOTEXT for Excel 365, see our dedicated guide.

Does XLOOKUP work in Google Sheets?

Yes. Google Sheets supports XLOOKUP with the same syntax, including search_mode. The only option missing is regex match_mode 3, which is Excel 365 only.

What is the difference between match_mode 2 and 3?

Match mode 2 uses Excel wildcards (*, ?, ~) for simple partial matching. Match mode 3 uses regular expressions (regex) for advanced pattern matching like “USA|United States” or “^Kim”. Wildcard mode is case-insensitive. Regex mode is case-sensitive by default (use (?i) to override). Regex is only available in Excel 365.

Why does XLOOKUP return #N/A when the value exists?

The most common cause is a data type mismatch. If your lookup_value is a number but the lookup_array contains numbers stored as text (or vice versa), XLOOKUP will not match. Check for leading spaces, trailing spaces, or non-breaking space characters. Use TRIM and CLEAN to standardize both sides.

Download the Practice Workbook

Get the XLOOKUP Practice Workbook

Practice every formula from this guide in the ready-to-use file. Free download.

Leila Gharani

Founder of XelPlus and ten-time Microsoft MVP. Leila helps over 500,000 professionals master Excel, Power BI, and data automation through practical, real-world training.