Excel track · Exercise 41 of 86 Paid
VLOOKUP and XLOOKUP on the same table
Read a price with either lookup and know which argument does which job.
Intermediate
Four products, one price column
Read-only data · screen 1 of 2 · answer in B7
In B7, return the unit price for the SKU typed in B6 using the table A1:C5.
| A | B | C | |
|---|---|---|---|
| 1 | SKU | Product | Unit price |
| 2 | BX-210 | Bracket | 2.4 |
| 3 | CX-330 | Clamp | 3.8 |
| 4 | DX-410 | Dowel | 1.15 |
| 5 | EX-500 | Extrusion | 9.6 |
| 6 | Which SKU? | CX-330 | |
| 7 | Unit price |
In B7, return the same unit price with XLOOKUP instead: the SKU in B6, the SKU column, the price column.
| A | B | C | |
|---|---|---|---|
| 1 | SKU | Product | Unit price |
| 2 | BX-210 | Bracket | 2.4 |
| 3 | CX-330 | Clamp | 3.8 |
| 4 | DX-410 | Dowel | 1.15 |
| 5 | EX-500 | Extrusion | 9.6 |
| 6 | Which SKU? | CX-330 | |
| 7 | Unit price |
Reference answer
What it does
Both functions take the SKU in B6, which is CX-330, and return the price beside it. VLOOKUP wants the whole table A2:C5 plus a column number: 3 counts SKU, product, price and lands on 3.8. That number only means price while the table starts at column A.
XLOOKUP names its two columns instead, A2:A5 to search and C2:C5 to return. Insert a column, move the price, and the formula still points at the price.
The fourth argument in VLOOKUP is the one that gets forgotten. FALSE makes a near miss fail rather than pass, and on a column of SKU codes a near miss is another product at another price.
Syntax
=VLOOKUP(value, table, column, FALSE) · =XLOOKUP(value, search, return)
Worked example
On Four products, one price column, =VLOOKUP(B6,A2:C5,3,FALSE) returns 3.8.
=VLOOKUP(B6,A2:C5,3,FALSE)
Common errors
| Error | What it means and how to fix it |
|---|---|
#N/A | The SKU is not in the searched column: a missing product, not a broken formula. |
#REF! | VLOOKUP's column number is wider than the table, which asks for a column the table does not have. |
At work
A supplier price list pasted into a sheet, where the SKU column is the only reliable key.