The book: files and exercises · Lesson 12 of 24

Lesson 12 exercises: VLOOKUP, XLOOKUP and INDEX MATCH

Four exercises on VLOOKUP, XLOOKUP and INDEX with MATCH, with the phone extension directory in lesson12.xlsx. The page also tries your formula with other employee IDs, so it can tell if FALSE is missing or if you typed the result by hand.

Lesson 12. Looking up data: VLOOKUP, XLOOKUP and INDEX + MATCH

Use the Exercises sheet in lesson12.xlsx: a company's directory of phone extensions.

Files: lesson12.xlsx · solutions: lesson12-solutions.xlsx.

In the exercises with a sheet, type the formula in the fx bar and click Check: the sheet works it out the way Excel does, with commas between the arguments (semicolons work too), and also tries it with other data, to see whether it still works when the data changes. In the other exercises, you work in Excel with the lesson's file and type the result here.

At the end of the page you'll find the lesson's Bonus challenge: one more exercise, whose answer isn't in the book. You check it only here.

Exercise 1

In G4, type a VLOOKUP formula that returns the department of the employee ID in G3. Which department do you get?
In cell G4
fx
Show the answer

=VLOOKUP(G3,A4:D11,3,FALSE) = Shipping (employee ID E06, Garcia).

Exercise 2

In G7, look up the department of the employee ID in G6, first with VLOOKUP. What appears, and why? Then write the formula with XLOOKUP so that it shows the text Not found.
First with VLOOKUP: what appears in G7?
fx
Then with XLOOKUP, so that it shows Not found
fx
Show the answer

With VLOOKUP, #N/A appears: employee ID E09 doesn't exist in the directory. With XLOOKUP: =XLOOKUP(G6,A4:A11,C4:C11,"Not found") = Not found.

Exercise 3

G9 holds a name. In G10, find that person's employee ID. Why isn't VLOOKUP enough here? Write the formula with INDEX + MATCH (or with XLOOKUP, if you have it).
Why isn't VLOOKUP enough here?
In cell G10
fx
Show the answer

The name is in column B and the employee ID, to its left, in column A: VLOOKUP only searches the first column and only returns data to its right. =INDEX(A4:A11,MATCH(G9,B4:B11,0)) = E03 (or =XLOOKUP(G9,B4:B11,A4:A11) = E03).

Exercise 4

Without Excel: what does =VLOOKUP("E04",A4:D11,4,FALSE) return on this sheet?
What does the formula return?
Show the answer

118: Davis's extension, the fourth column of the E04 row.

Bonus challenge

The answer isn't in the book: you check it only here.

Orders sheet: fill in Item, Price and Amount from the price list, as in the lesson. Which order has the highest amount? Write down its number. Take a close look at the row of the code that is missing from the price list.
Which order has the highest amount? (its number)
Show the answer

With =VLOOKUP(C4,Prices!$A$4:$D$13,2,FALSE) in E4, =VLOOKUP(C4,Prices!$A$4:$D$13,4,FALSE) in F4 and =D4*F4 in G4, copied down to row 11, the highest amount is order 1006, from Oak Hill Elementary: 40 college ruled spiral notebooks (P105) at $2.40 each, so $96.00. Order 1002 has the largest quantity (50 pens), but the pens are cheap: it comes to $60.00. Order 1005 has the code P104, which isn't in the price list: with FALSE it shows #N/A in all three columns. Without FALSE, VLOOKUP would quietly take the closest code, P103, and give a wrong price.