=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]) finds a value in one row or column and returns the corresponding item from another, in any direction, with exact matching on by default. The function is available in Excel for Microsoft 365, Excel 2024, Excel 2021, and Excel for the web; it is not in Excel 2019 or earlier.

XLOOKUP replaces the column-counting and sort-order quirks of VLOOKUP and HLOOKUP with a cleaner model: you give it the search range and the return range, and it aligns them by position. Exact match is the default, so the classic VLOOKUP trailing-zero argument is unnecessary. The five practical things to master are the required three arguments, the not-found text, the match modes, the search modes, and wildcard behavior inside match_mode 2.

XLOOKUP Syntax and Argument Reference

Argument Required What it does Accepted values
lookup_value Yes The value to find Text, number, cell reference, or blank
lookup_array Yes The row or column to search One-dimensional range or array
return_array Yes Where the answer comes from Same size and orientation as lookup_array
if_not_found No Text or value returned when nothing matches Any value; omit to get #N/A
match_mode No How values are compared 0 exact (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard
search_mode No Direction and method of the search 1 first-to-last (default), -1 last-to-first, 2 binary ascending, -2 binary descending

Binary modes 2 and -2 do require the lookup_array to be sorted. The default exact mode, the approximate modes -1 and 1, and wildcard mode 2 do not require sorted data. That distinction matters because many users assume XLOOKUP always needs a sorted list, which is false.

How to Write an XLOOKUP Formula

  1. Click the cell where the answer should appear and type =XLOOKUP(.
  2. Enter the lookup_value — a cell reference is safest, so the formula can be dragged or copied down.
  3. Select the lookup_array (the single column or row holding the search values).
  4. Select the return_array (the matching column or row holding the answers).
  5. Add , "Not found" after the return array to suppress #N/A and display readable text instead.
  6. Close the parenthesis and press Enter. The cell should show the matched value; if it shows #N/A, the lookup value isn't present in the lookup array, and if it shows #VALUE!, the two ranges likely differ in size.

Worked Examples With Concrete Cell References

Use the following starting table in A1:C6 for all three examples. Column A holds part numbers, column B holds descriptions, and column C holds prices.

A (Part) B (Description) C (Price)
P-100 Bracket 4.50
P-101 Housing 9.25
P-102 Seal ring 1.10
P-103 Bolt kit 6.75
P-104 Gasket 2.30

Example 1 — Exact Match (Default Behavior)

To find the price of part P-102, in F2 enter:

=XLOOKUP("P-102", A2:A6, C2:C6)

This returns 1.10. Because match_mode defaults to 0, only an exact part number counts. Change the first argument to a cell reference such as E2 so you can test multiple parts without rewriting the formula, and add , "Not found" as the fourth argument to return friendly text when a part number is missing from the list.

Example 2 — Reverse Lookup and Last-Match

Suppose you only know the price 6.75 and want the part number. XLOOKUP searches left, unlike VLOOKUP:

=XLOOKUP(6.75, C2:C6, A2:A6)

This returns P-103. If duplicate prices exist, the default search_mode 1 returns the first match from top to bottom; adding , , , , ,-1 as the sixth argument returns the last match instead. That reverse search order is useful when the table is appended with newer records at the bottom.

Example 3 — Approximate, Wildcard, and Multi-Column Return

For a price-based lookup where the exact value isn't in the array, match_mode -1 returns the next smaller match:

=XLOOKUP(5.00, C2:C6, A2:A6, , -1)

This returns the part with the largest price at or below five dollars, useful for tiered discount tables.

For text matching with wildcards, use match_mode 2:

=XLOOKUP("*ring*", B2:B6, A2:A6, , 2)

This returns P-102 because "Seal ring" contains "ring". Wildcards * (any characters) and ? (one character) only work in match_mode 2, and they only apply to text values.

To return more than one column at once, give a wider return range:

=XLOOKUP("P-101", A2:A6, B2:C6)

In Excel 365 and Excel 2024, this spills the description and price into two adjacent cells automatically as a dynamic array. In Excel 2021, the spill behaves the same way inside a single cell because the result is an array; if you need both values visible, wrap the call in INDEX and address each column, or place the formula in a cell with room to spill to the right.

XLOOKUP Error Troubleshooting

Error Likely cause Verified fix
#N/A lookup_value not in lookup_array, or text/number type mismatch Confirm the value exists, strip stray spaces with TRIM, and check that both ranges are formatted consistently (text vs. number, not one of each)
#VALUE! lookup_array and return_array differ in row or column count Confirm both ranges share the same starting row and use the same number of rows (or columns)
#NAME? Function name misspelled, or a version without XLOOKUP Type =XLOOKUP and select it from the dropdown; verify the ribbon shows Excel 365, 2024, or 2021
#SPILL! The formula's dynamic-array result overlaps existing data Clear the target range or move the formula, especially for multi-column returns
#CALC! Return array is empty or mis-sized for the requested match mode Re-check both ranges and confirm match_mode matches the data type
No error, wrong answer Wildcards used with match_mode 0, approximate mode hitting a boundary, or unsorted data in a binary mode Switch to match_mode 2 for wildcards, 0 for exact, and reserve search_mode 2/-2 for sorted data

The #NAME? error is the most common confusing one: it almost always means the workbook is open in an older Excel version or in a spreadsheet app that doesn't implement XLOOKUP. In that case, replace it with INDEX and MATCH:

=INDEX(C2:C6, MATCH("P-102", A2:A6, 0))

XLOOKUP vs. VLOOKUP and When to Use Which

Both functions return values from a row, but XLOOKUP is more forgiving. It doesn't care which side the return column is on, doesn't require a column index number, and returns exact matches by default rather than approximate ones. That last point alone prevents a very common error where a VLOOKUP silently returns a wrong row because the fourth argument was left blank and the data wasn't sorted.

For a side-by-side comparison of lookup functions, see Microsoft's reference page for the XLOOKUP function. Use XLOOKUP for new workbooks in modern Excel, keep VLOOKUP only where a file must open in Excel 2019 or an older app, and use INDEX/MATCH as the compatibility fallback when portability matters.

Frequently Asked Questions

Can XLOOKUP look up to the left?

Yes. lookup_array and return_array simply need to share size and orientation; the position of each range in the sheet is irrelevant. The formula in Example 2 above looks up a price in column C and returns a part number from column A, which is exactly a reverse lookup.

Does XLOOKUP require sorted data?

Only for the binary search_mode values 2 and -2. The default search_mode 1, its reverse -1, and approximate match_mode -1/1 and wildcard match_mode 2 all work against unsorted data. If you inherit a workbook that expects sorted data, sort the lookup column first or use the default linear search.

Is XLOOKUP case-sensitive?

No. It compares text without case sensitivity, so "p-102" and "P-102" match. For a case-sensitive lookup, wrap the comparison in EXACT over the lookup array or build a helper column that normalizes case before lookup, then reference that helper column.

Why does XLOOKUP show #N/A when the value is clearly there?

The most frequent cause is a type mismatch: the lookup value is stored as text with leading or trailing spaces, or a number stored as text in one range and as a number in the other. Wrap the lookup value in TRIM, or select the column and use Data > Text to Columns > Finish to coerce consistent types, then retest the formula.