How to use XLOOKUP in Excel
Learn how to use XLOOKUP in Excel to search ranges, return values in any direction, handle missing data, and replace VLOOKUP with hands-on practice.
Syntax
fx=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Arguments
lookup_value(required)The value you want to search for.
lookup_array(required)The range or column to search within.
return_array(required)The range or column that holds the value you want to return.
if_not_found(optional)The text or value to display if no match is found, instead of #N/A.
match_mode(optional)0 for exact match (default), -1 for next smaller, 1 for next larger, or 2 for wildcard match.
search_mode(optional)1 to search from first to last (default), -1 to search in reverse, 2 or -2 for binary search.
What XLOOKUP does
XLOOKUP searches a range for a specific value and returns a matching value from another range. It defaults to an exact match, so you do not need to add extra flags for everyday lookups. Here, the formula searches for the item in A6 and returns its price.
| Item | Category | Price |
| Espresso | Drink | 3 |
| Croissant | Bakery | 4 |
| Muffin | Bakery | 3 |
| Tea | Drink | 2 |
| Croissant | Find Price |
Formula: =XLOOKUP(A6,A2:A5,C2:C5) → 4
Look up to the left
Earlier functions like VLOOKUP can only return values to the right of your lookup column. With XLOOKUP, your return range can sit anywhere. Here, the formula looks up bib 425 in column B and returns the runner name from column A on its left.
| Runner | Bib | Distance |
| Ananya | 204 | 5 |
| Bilal | 318 | 10 |
| Chloe | 425 | 21 |
| Dan | 512 | 10 |
| 425 | Find Runner |
Formula: =XLOOKUP(B6,B2:B5,A2:A5) → Chloe
Handle missing values cleanly
When a lookup value does not exist, Excel normally returns a #N/A error. You can use XLOOKUP’s fourth argument to show a friendly fallback message instead of wrapping your formula in IFERROR. In this example, searching for missing order 1099 returns Not Found.
| Order ID | Customer | Status |
| 1001 | Amina | Shipped |
| 1002 | Carlos | Delivered |
| 1003 | Deepa | Pending |
| 1099 | Find Status |
Formula: =XLOOKUP(A5,A2:A4,C2:C4,"Not Found") → Not Found
Common mistake: Mismatched range sizes
Both lookup_array and return_array must have the exact same number of rows or columns. If you search four cells in A2:A5 but supply five cells in C2:C6 to return from, Excel cannot align the rows and displays a #VALUE! error. Always make sure your two ranges start and end on matching row numbers.