Basic XLOOKUP Syntax
The core structure of XLOOKUP separates the search column from the return column:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])
- lookup_value: The cell or value you want to search for (for example,
A2). - lookup_array: The single column or row where you search for that value (for example,
$D$2:$D$100). - return_array: The single column or row containing the value you want back (for example,
$E$2:$E$100). - [if_not_found]: Optional text or value returned when no match is found, such as
"Not Found".
Worked Example: Looking Up Product Prices
Suppose A2 holds a product SKU you want to price-check against a reference table in columns D and E:
=XLOOKUP(A2, $D$2:$D$100, $E$2:$E$100, "Not Found")
| Cell A2 (Searched SKU) | Col D (SKU List) | Col E (Unit Price) | XLOOKUP Result |
|---|---|---|---|
| SKU-104 | SKU-104 | $45.00 | $45.00 |
| SKU-999 | SKU-105 | $60.00 | Not Found |
Common Mistakes & How to Prevent Them
- Forgetting
$on ranges: If you dragD2:D100down to row 3 without locking it as$D$2:$D$100, the search range shifts down and misses top rows. - Mismatched range lengths:
lookup_arrayandreturn_arraymust cover the same number of rows (for example, both2:100). - Hidden spaces in text IDs: If an imported ID has trailing spaces, clean the source column with
TRIM()before matching.
Practical Tip: Want to test different cell ranges or switch between Excel and Google Sheets syntax? Use the Formula Finder to customize your expression and copy it in one click.