XLOOKUP
Searches a range for a match and returns the corresponding value from another range
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])This static page keeps the function indexed for search, while the spreadsheet app handles interactive exploration and saved formulas.
What the function does
Overview
Searches a range for a match and returns the corresponding value from another range
XLOOKUP is a versatile replacement for older lookup functions like VLOOKUP and HLOOKUP, offering better performance and simpler syntax. Unlike VLOOKUP, it defaults to an exact match and allows the return array to be located to the left or above the lookup array without rearranging data. It features a built-in [ound] argument, which is a modern and more efficient alternative to wrapping the formula in IFERROR, preventing the accidental masking of legitimate syntax errors. For best results, ensure the rray and rray have identical dimensions; otherwise, a #VALUE! error will occur. It supports advanced features like wildcard matching (using * or ?) and bidirectional searching (first-to-last or last-to-first), making it ideal for finding the most recent entry in a log or handling unsorted datasets without requiring a binary sort.
Quick reference
Syntax
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Inputs
Arguments
Example: A2
Example: A:A
Example: B:B
Example: "Not Found"
Example: 0
Example: 1
Formula patterns
Examples
Basic exact match with custom error message
=XLOOKUP(A2, B2:B10, C2:C10, "not found")Approximate match for tiered commission rates
=XLOOKUP(A2, B2:B5, C2:C5, 0, -1)Search from bottom to top for latest entry
=XLOOKUP(A2, B2:B20, C2:C20, "none", 0, -1)Wildcard search for partial text matches
=XLOOKUP(A2 & "*", B2:B10, C2:C10, "no match", 2)Avoid these issues
Common Errors
#N/A
Cause: The lookup_value cannot be found in the lookup_array and the [if_not_found] argument is omitted.
Fix: Verify the lookup value exists in the source array or provide a custom string in the fourth argument to handle missing values.
#VALUE!
Cause: The lookup_array and return_array have different lengths or incompatible dimensions.
Fix: Ensure both range references cover the exact same number of rows or columns (e.g., B2:B10 and C2:C10).
Platform support
Compatibility
Available in Excel 2021+ and Microsoft 365
Source: Microsoft Support
Common questions
Frequently Asked Questions
Searches a range for a match and returns the corresponding value from another range
alue: The value to search for rray: The range to search in rray: The range to return from ound: Value to return if no match found ode: 0=exact, -1=exact or next smaller, 1=exact or next larger, 2=wildcard ode: 1=first to last, -1=last to first, 2=binary ascending, -2=binary descending
#N/A: Verify the lookup value exists in the source array or provide a custom string in the fourth argument to handle missing values. #VALUE!: Ensure both range references cover the exact same number of rows or columns (e.g., B2:B10 and C2:C10).