Syntax
| Parameter | Description |
|---|---|
| lookup_value | Parameter of the XLOOKUP function. |
| lookup_array | Parameter of the XLOOKUP function. |
| return_array | Parameter of the XLOOKUP function. |
| [if_not_found] | (Optional.) Parameter of the XLOOKUP function. |
| [match_mode] | (Optional.) Parameter of the XLOOKUP function. |
Examples
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Product | SKU | Price | Stock |
| 2 | Widget | W-100 | 24.99 | 150 |
| 3 | Gadget | G-200 | 49.99 | 75 |
| 4 | Gizmo | Z-300 | 14.99 | 300 |
Simple product price lookup
=XLOOKUP("Widget", A2:A100, C2:C100)
With default value for not found
=XLOOKUP(E1, A2:A100, B2:B100, "Not Found")
Return multiple columns
=XLOOKUP("Widget", A2:A100, B2:D100)
Common Errors
The value was not found and no if_not_found argument was provided. Add a fourth argument for a default value.
The lookup_array and return_array have different sizes. They must have the same number of rows (or columns).
Tips
XLOOKUP's 4th argument replaces the need for wrapping with IFERROR: =XLOOKUP(val, range, result, "Not found").
Unlike VLOOKUP, XLOOKUP defaults to exact match. No more accidental approximate matches from forgetting FALSE.
Use -1 as the 6th argument to search from the last match: =XLOOKUP(val, range, result, , 0, -1) finds the last occurrence.
Try XLOOKUP in Viztab
Import your data and use XLOOKUP with 370+ other formulas. No signup required.
Open Viztab