Skip to main content
FlightDeck

Prices with XLOOKUP

Pull unit prices from a product list by code, fix the list with $ signs and handle codes that are not listed.

20% complete

Training

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])
Find lookup_value in lookup_array, then return the cell in the same position of return_array. The two ranges must be the same size, in one column (or one row).
Price list in E1:G6 (KES)
RowE: CodeF: ProductG: Price (KES)
2SS-210School shoe2499
3SN-450Canvas sneaker1999
4SD-120Ladies sandal899
5BT-330Ankle boot4599
6SL-075Slipper499
=XLOOKUP("SN-450",$E$2:$E$6,$G$2:$G$6,"Not listed")
Look for the code SN-450 in the Code column and return the price from the same row. In the order sheet you will point at the code cell instead of typing it, and the $ signs keep the price list fixed when you copy the formula down.
  • Exact match only: XLOOKUP returns the first row whose code matches. Upper and lower case do not matter, so sd-120 finds SD-120.
  • A number never matches text that looks like a number: 1050 and "1050" are different codes.
  • When nothing matches, XLOOKUP shows #N/A. The optional fourth argument replaces it, for example "Not listed".
  • This simulator supports exact match only: the extra match_mode and search_mode arguments give #VALUE!. For tier tables, see the nested IF exercise.