For teachers / Answer key
Answer key: Lookups
For teachers. This page is kept out of search engines and linked only from the teachers page. Students can see the same answers in a lesson with Show answer. Any formula that gives the right values counts.
1. VLOOKUP: exact matches (Intermediate, 4 min)
The SKU to look up is in
G2. InG3, return its product name, which is column 2 of the table:=VLOOKUP(G2, A2:D9, 2, FALSE)G3=VLOOKUP(G2, A2:D9, 2, FALSE)
Shows G3: Garden gloves
In
G4, look up the price. It is the same formula with a different column number, because Price is column 3 of the table.G4=VLOOKUP(G2, A2:D9, 3, FALSE)
Shows G4: $11.25
Finish the card: in
G5, return how many are in stock.G5=VLOOKUP(G2, A2:D9, 4, FALSE)
Shows G5: 54
Now the payoff. Type
GC-122intoG2and watch all three answers update at once.G2GC-122
Shows G2: GC-122
2. Approximate match for tiers and bands (Intermediate, 5 min)
Harbour Café ordered $640. In
C2, find its discount in the tier tableG2:I6:=VLOOKUP(B2, $G$2:$I$6, 2, TRUE). The dollar signs lock the table so you can copy the formula down next.C2=VLOOKUP(B2, $G$2:$I$6, 2, TRUE)
Shows C2: 8%
Copy
C2down toC8to find the discount for every order.C3:C8=VLOOKUP(B3, $G$2:$I$6, 2, TRUE)then copy it across the range
Shows C3: 0%, C4: 12%, C5: 5%, C6: 15%, C7: 5%, C8: 12%
In
D2:D8, return each order's tier name from column 3 of the table. This time you can leave out the last argument, because TRUE is the default.D2:D8=VLOOKUP(B2, $G$2:$I$6, 3)then copy it across the range
Shows D2: Silver, D3: Standard, D4: Gold, D5: Bronze, D6: Platinum, D7: Bronze, and 1 more
Finally, in
E2:E8, work out what each customer pays: the order total multiplied by (1 minus the discount).E2:E8=B2*(1-C2)then copy it across the range
Shows E2: $588.80, E3: $180.00, E4: $1,100.00, E5: $237.50, E6: $2,528.75, E7: $474.99, and 1 more
3. INDEX and MATCH (Intermediate, 5 min)
Start with INDEX on its own. In
G2, return the 3rd name in the directory:=INDEX(A2:A9, 3)G2=INDEX(A2:A9, 3)
Shows G2: Chen Wei-Ling
Now the opposite question. In
G5, find where the name inG4appears in the list:=MATCH(G4, A2:A9, 0)G5=MATCH(G4, A2:A9, 0)
Shows G5: 5
Combine them. In
G6, return Emeka's department in a single formula: MATCH finds the position, and INDEX reads that position from the Department column.=INDEX(B2:B9, MATCH(G4, A2:A9, 0))G6=INDEX(B2:B9, MATCH(G4, A2:A9, 0))
Shows G6: Engineering
A voicemail quotes the staff ID in
G8. InG9, find that person's name. The IDs are in column D, to the right of the names, so VLOOKUP can't do this one.G9=INDEX(A2:A9, MATCH(G8, D2:D9, 0))
Shows G9: Gideon Park
4. XLOOKUP (Intermediate, 5 min)
A reader has requested the books in
F2:F6. InG2, look up the title of the first request:=XLOOKUP(F2, $A$2:$A$9, $B$2:$B$9). Both ranges are locked so you can copy the formula down next.G2=XLOOKUP(F2, $A$2:$A$9, $B$2:$B$9)
Shows G2: Paper Lanterns
Copy the formula down to
G6. One request is not in the catalogue, so add a fourth argument that showsNot in catalogueinstead of #N/A.G2:G6=XLOOKUP(F2, $A$2:$A$9, $B$2:$B$9, "Not in catalogue")then copy it across the range
Shows G2: Paper Lanterns, G3: Beneath the Orchard, G4: Not in catalogue, G5: Tides of Amber, G6: The Last Ferry North
In
H2:H6, return the number of copies for each request. It is the same search with a different return range. Use0for if_not_found, since a missing book has no copies.H2:H6=XLOOKUP(F2, $A$2:$A$9, $D$2:$D$9, 0)then copy it across the range
Shows H2: 2, H3: 1, H4: 0, H5: 3, H6: 2
Now search the other way. In
G10, find the Book ID for the title inG9. The ID column is to the left of the titles, which XLOOKUP handles without any fuss.G10=XLOOKUP(G9, B2:B9, A2:A9)
Shows G10: BK-3323
5. Two-way lookups (Advanced, 6 min)
A customer wants a hoodie in the size in
I2and the colour inI3. InI4, use MATCH to find which row of the grid that size is on, searching the size labels inA2:A6.I4=MATCH(I2, A2:A6, 0)
Shows I4: 3
In
I5, find which column the colour is in, searching across the header rowB1:F1.I5=MATCH(I3, B1:F1, 0)
Shows I5: 4
In
I6, fetch the price from the gridB2:F6with INDEX, using both positions:=INDEX(B2:F6, I4, I5)I6=INDEX(B2:F6, I4, I5)
Shows I6: $35.00
Helper cells are great while you build a formula, but you can nest everything. In
I8, get the same price in one formula, with both MATCHes inside INDEX.I8=INDEX(B2:F6, MATCH(I2, A2:A6, 0), MATCH(I3, B1:F1, 0))
Shows I8: $35.00
A side note: HLOOKUP is VLOOKUP turned on its side. It searches the top row of a table and returns from a row further down. In
I10, find the size M price for the chosen colour:=HLOOKUP(I3, B1:F6, 3, FALSE)I10=HLOOKUP(I3, B1:F6, 3, FALSE)
Shows I10: $34.00