XLOOKUP Function

Excel Functions › Lookup & Reference

Excel 365 Excel 2021+ Excel for the Web Dynamic Array

The Excel XLOOKUP function searches a range for a value and returns the matching item from another range. It is the modern replacement for VLOOKUP, HLOOKUP, and most INDEX/MATCH formulas — it looks in any direction, defaults to exact match, handles missing values gracefully, and can return entire rows or columns at once.


Quick answer: to look up E2 in column A and return the matching value from column C:
=XLOOKUP(E2, A2:A10, C2:C10)
If the value isn't found, XLOOKUP returns #N/A — add a fourth argument like "Not found" to replace that error with friendly text.

Syntax

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
ArgumentDescription
lookup_valueRequiredThe value to search for.
lookup_arrayRequiredThe range or array to search in. One row or one column.
return_arrayRequiredThe range or array to return values from. Must be the same length as lookup_array; can be multiple columns or rows (the result spills).
if_not_foundOptionalValue to return when no match is found. Without it, XLOOKUP returns #N/A.
match_modeOptional0 = exact match (default) · -1 = exact or next smaller · 1 = exact or next larger · 2 = wildcard match (*, ?, ~).
search_modeOptional1 = search first-to-last (default) · -1 = search last-to-first · 2 = binary search ascending · -2 = binary search descending.

The two arguments that matter most: 95% of XLOOKUP formulas only use the first three arguments plus if_not_found. Unlike VLOOKUP, the default is an exact match, so there is no FALSE to remember.

Basic exact-match lookup

The worksheet below holds a small employee table. To find Maria Lopez's department, look her name up in column A and return the matching value from column B:

ABCEF
1NameDepartmentSalaryLookupResult
2James ChenSales$71,200Maria LopezMarketing
3Maria LopezMarketing$68,400
4Devon SmithSales$74,800
5Priya PatelFinance$82,100
6Alex RiveraIT$79,500

The formula in F2 is:

=XLOOKUP(E2, A2:A6, B2:B6) // returns "Marketing"

Read it left to right as a sentence: "Find E2 (Maria Lopez) in A2:A6, and give me the matching value from B2:B6." Change B2:B6 to C2:C6 and the same formula returns her salary instead. No column counting, no FALSE, no broken formulas when someone inserts a column.

Try it: interactive XLOOKUP demo

Live demo

Build an XLOOKUP against the employee table above. Change the inputs and watch the formula and result update — including what happens when the name doesn't exist.

Result:

Handling "not found" gracefully

When XLOOKUP can't find the lookup value, it returns the #N/A error. With VLOOKUP you needed to wrap the whole formula in IFERROR; XLOOKUP builds the fix in as the fourth argument:

=XLOOKUP(E2, A2:A6, B2:B6, "No such employee")

Tip: if_not_found accepts anything — text, a number, "" for blank, or even another formula. A common pattern is a fallback lookup: =XLOOKUP(E2, A2:A6, B2:B6, XLOOKUP(E2, OldList, OldDepts, "Not anywhere")).

Left lookup (the VLOOKUP killer)

VLOOKUP can only return values to the right of the lookup column. XLOOKUP doesn't care about direction, because the lookup range and return range are separate arguments. Given IDs in column C and names in column A, you can look up an ID and return the name to its left:

ABCEF
1NameDepartmentEmp IDLookup IDName
2James ChenSalesE-1042E-1077Priya Patel
3Maria LopezMarketingE-1058
4Devon SmithSalesE-1063
5Priya PatelFinanceE-1077
6Alex RiveraITE-1090
=XLOOKUP(E2, C2:C6, A2:A6) // looks right-to-left, no problem

Approximate match: tiers, brackets, and rates

Commission tiers, tax brackets, shipping bands, volume discounts — these all need "find the bracket this number falls into," not an exact match. Set match_mode to -1 (exact match or next smaller value):

ABDE
1Sales at leastCommissionSalesRate
2$02%$83,5006%
3$25,0004%
4$50,0006%
5$100,0008%
=XLOOKUP(D2, A2:A5, B2:B5, , -1) // $83,500 falls in the $50,000 tier → 6%

$83,500 isn't in the table, so XLOOKUP takes the next smaller value, $50,000, and returns its rate. Unlike VLOOKUP's approximate mode, the table does not need to be sorted (sorting is only required if you also use binary search_mode).

Live demo

Drag the sales amount and watch which tier match_mode -1 lands on.

Matched tier:  →  Commission:

More power: spill, wildcards, and last match

Return several columns at once (spill)

Make return_array wider than one column and a single formula returns the whole row, spilling across adjacent cells:

=XLOOKUP("Maria Lopez", A2:A6, B2:C6) // returns Marketing AND $68,400, side by side

Wildcard match

Set match_mode to 2 to use wildcards: * for any characters, ? for one character:

=XLOOKUP("*lopez*", A2:A6, B2:B6, "Not found", 2) // matches "Maria Lopez"

Find the LAST match

By default XLOOKUP returns the first match from the top. Set search_mode to -1 to search bottom-up — perfect for "most recent transaction" when data is in date order:

=XLOOKUP("Acme Corp", A2:A500, C2:C500, , 0, -1) // last (most recent) order for Acme

Two-way lookup (row AND column)

Nest one XLOOKUP inside another to match both a row and a column — a cleaner replacement for INDEX/MATCH/MATCH:

=XLOOKUP(H2, A2:A13, XLOOKUP(H3, B1:F1, B2:F13)) // month down the side, region across the top

The inner XLOOKUP finds the right column, and hands it to the outer XLOOKUP as the return array; the outer one finds the right row within it.

XLOOKUP vs VLOOKUP

If you know VLOOKUP, here is the whole story in one table:

XLOOKUPVLOOKUP
Default match typeExactApproximate (silent wrong answers if you forget FALSE)
Look left of the lookup columnYesNo
Built-in "not found" messageYes — 4th argumentNo — needs IFERROR wrapper
Survives inserting/deleting columnsYes — no column numbersNo — col_index_num breaks
Horizontal lookupYes — same functionNo — separate HLOOKUP
Search from the bottomYes — search_mode -1No
Return multiple columnsYes — spillsNo
Works in Excel 2019 and olderNoYes

Translating an old formula is mechanical. This VLOOKUP:

=VLOOKUP(E2, A2:C6, 2, FALSE)

becomes this XLOOKUP — point at the two columns directly instead of counting to "2":

=XLOOKUP(E2, A2:A6, B2:B6)

Errors & common pitfalls

#N/A — value not found. The most common result. Causes: the value truly isn't there, or it "looks" there but differs invisibly — extra spaces ("Maria Lopez "), text-formatted numbers vs real numbers, or smart quotes from pasted data. Fix the data with TRIM or convert text numbers, or supply if_not_found to handle legitimate misses.

#VALUE! — mismatched array sizes. lookup_array and return_array must be the same length. =XLOOKUP(E2, A2:A6, B2:B7) fails because A has 5 cells and B has 6.

#SPILL! — no room for results. When the return array is multiple columns/rows, the result needs empty cells to spill into. Clear whatever is blocking the spill range.

Pitfall: locking ranges before you copy. If you copy the formula down a column, lock the arrays with absolute references: =XLOOKUP(E2, $A$2:$A$6, $B$2:$B$6). Otherwise the ranges shift as you copy and rows near the bottom silently miss matches. (Excel tables — Ctrl+T — avoid this entirely with structured references.)

Pitfall: binary search modes. search_mode 2 and -2 are fast on huge sorted data but return wrong answers without any error on unsorted data. Unless you have hundreds of thousands of rows and a sorted table, leave search_mode alone.

Pitfall: it's not in Excel 2019. XLOOKUP requires Excel 2021, Excel 365, or Excel for the web. If your file will be opened in older versions, those users see #NAME?. Use INDEX/MATCH or VLOOKUP for backward compatibility.

Practice workbook

📊
Download the free XLOOKUP practice workbook
Every example on this page, ready to open in Excel — plus 5 practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

Is XLOOKUP better than VLOOKUP?
Yes, in nearly every way: it defaults to exact match, looks in any direction, has built-in "not found" handling, doesn't break when columns are inserted, and replaces HLOOKUP too. The only reason to still use VLOOKUP is compatibility with Excel 2019 and older.
What versions of Excel have XLOOKUP?
XLOOKUP is available in Excel for Microsoft 365, Excel 2021 and later, Excel for the web, and Excel mobile apps. It is NOT available in Excel 2019, 2016, or older — those versions show a #NAME? error.
Why does my XLOOKUP return #N/A when the value is clearly there?
Almost always an invisible difference: trailing spaces in one of the two ranges, a number stored as text on one side and a real number on the other, or non-breaking spaces from data pasted off the web. Test with =A2=E2 on a suspect pair — if it says FALSE, clean the data with TRIM, or convert text numbers using Data → Text to Columns.
Can XLOOKUP return multiple columns?
Yes. Make the return_array more than one column wide (e.g., B2:D100) and the single formula spills the entire matching row into adjacent cells.
Can XLOOKUP look up based on two criteria?
Yes — concatenate the criteria inside the formula: =XLOOKUP(G2&H2, A2:A100&B2:B100, C2:C100). This joins the two lookup columns on the fly, no helper column needed.
Is XLOOKUP faster or slower than VLOOKUP?
On typical worksheets the difference is negligible. On very large sorted datasets, XLOOKUP's binary search modes (search_mode 2 or -2) can be dramatically faster — but only use them when data is sorted, since they return incorrect results on unsorted data.
What replaces VLOOKUP's TRUE / approximate match?
Use match_mode -1 (exact or next smaller). Bonus: unlike VLOOKUP, the table does not need to be sorted.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: VLOOKUP · INDEX · MATCH · HLOOKUP · LOOKUP