Why this matters
Lookups such as VLOOKUP and XLOOKUP are named in accounts and reporting job adverts in Ghana and across the region. Offices keep information in separate lists: a price list, a staff list, a list of districts and regions. A lookup joins them. Type a product code and the price appears; type a staff ID and the name and district appear. Without lookups, people copy and paste by hand, and mistakes creep in.
XLOOKUP
XLOOKUP searches one column for a value and returns the matching item from another column:
=XLOOKUP(what, where to look, what to return)Say your price list is on a sheet called Prices, with codes in column A and prices in column C. In your sales sheet, the item code is in C2. To get the price:
=XLOOKUP(C2, Prices!A:A, Prices!C:C)Read it as: "find C2 in the codes, and give me the price on the same row". Prices!A:A means column A on the Prices sheet. Fill it down and every sale gets its price.
XLOOKUP looks for an exact match by default, which is what you want for codes and IDs. You can add a fourth argument for what to show when nothing is found:
=XLOOKUP(C2, Prices!A:A, Prices!C:C, "Code not found")Without it, a missing code shows #N/A. That error is useful: it tells you a code is misspelled, has an extra space, or is missing from the list.