Skip to content
YTutorby Yilmaz
EnglishEN

Topic 5 of 15, EHL Maths & Excel final (AP)

⇄

XLOOKUP

XLOOKUP searches for one value in a reference table and returns the related information from another column. It is the standard way to bring a price, a name or a rate from a second sheet.

When the exam asks for it

  • “retrieve”, “find the price of”, “bring the rate from the other table / sheet”

Formulas

Structure=XLOOKUP(lookup_value, lookup_array, return_array)
With a message if nothing is found=XLOOKUP(lookup_value, lookup_array, return_array, "Not found")
Price from the Rates sheet=XLOOKUP(B2, Rates!$A$2:$A$4, Rates!$C$2:$C$4)
Room type from the Rates sheet=XLOOKUP(B2, Rates!$A$2:$A$4, Rates!$B$2:$B$4)

Worked example

Table 1: Rates sheet. The reference table: Excel searches the room code in column A and takes the answer from column B or C.

C5fx
ABCD
1Room codeRoom typePrice (CHF)
2STDStandard180
3DLXDeluxe260
4STESuite420
5
BookingsRates

Table 2: Bookings sheet. The table you work in: you type the room code, XLOOKUP fills in the room type and the price (yellow cells).

D2fx=XLOOKUP(B2, Rates!$A$2:$A$4, Rates!$C$2:$C$4, "Not found")
ABCDE
1GuestRoom codeRoom typePrice (CHF)
2MeierDLXDeluxe260
3RossiSTDStandard180
4KellerSTESuite420
5WeberXYZNot foundNot found
6
BookingsRates
⬇ Download practice ExcelExample, Practice and Answers sheets with working formulas. Free.

Step by step

  1. Find the reference tablethe Rates sheet (Table 1) has the room types and prices
  2. Find what links both tablesthe room code: column B in Bookings, column A in Rates
  3. lookup_value: one cellB2 in the Bookings sheet, here DLX
  4. lookup_array: where to searchRates!$A$2:$A$4, the room codes
  5. return_array: what to bring backRates!$C$2:$C$4 for the price, Rates!$B$2:$B$4 for the room type
  6. =XLOOKUP(B2, Rates!$A$2:$A$4, Rates!$C$2:$C$4, "Not found")260 for DLX in D2; fill down for every booking
  7. =XLOOKUP(B2, Rates!$A$2:$A$4, Rates!$B$2:$B$4, "Not found")Deluxe in C2; only the return_array changes
  8. Row 5: code XYZ is not in Ratesthe 4th argument shows Not found instead of #N/A

⚠ Exam traps

  • Lock the two reference ranges with $, otherwise they slide down when you fill the formula.
  • lookup_value is a single cell, not a whole column.
  • lookup_array and return_array must have the same number of rows.
  • #N/A means the value was not found: check spelling and extra spaces, or add a 4th argument like "Not found".
Practice question

A booking has room code STE. Which price does the XLOOKUP above return?

Show answer

✓ 420 CHF.

Stuck on this topic before your exam? We explain it one-to-one on your own Excel files, live online. Short crash courses before the EHL Maths & Excel final are possible on weekdays and weekends.

Book a lesson

Tell us your course, your exam date and the topics that worry you. We start with what matters most for your grade.

Send a message

We answer by email or WhatsApp.

Give your email or your WhatsApp number (or both) so we can answer you.

← Pass AP guide← Pass AP
WhatsApp