Confident CellsExcel practice Start free

VLOOKUP practice: practice exercises

price lists, column numbers, IFERROR, VLOOKUP in a sum, MATCH for the column. 5 exercises on real-looking data, each marked the moment you press Check. The first exercise is below to try now; the full lesson is part of Pro.

Your turn

In D2, look up the unit price of each order's product in the price list in G2:H9, then copy it down to D13.

ABCDEFGH
1OrderProduct codeQuantityUnit priceCodePrice (£)
22401P-1195P-132£29.71
32402P-13112P-133£10.76
42403P-1319P-107£42.67
52404P-1328P-127£19.47
62405P-1271P-123£39.26
72406P-1311P-119£36.04
82407P-1199P-131£43.38
92408P-13310P-125£14.27
102409P-1258
112410P-1253
122411P-12512
132412P-1195

How it works

Five VLOOKUPs of the kind that turn up at work. Each time, ask the same four questions: what am I looking up, where is the table, which column holds the answer, and do I want an exact match (FALSE)?

Lock the table with $ signs when the formula is copied down. Wrap it in IFERROR when some values won't be found. Let MATCH work out the column number when it can change.

=VLOOKUP(A2,$F$2:$G$6,2,FALSE) =IFERROR(VLOOKUP(A2,$F$2:$G$6,2,FALSE),"Missing") =VLOOKUP(F1,A2:D6,MATCH(F2,A1:D1,0),FALSE)

Four questions for every VLOOKUP

  1. What am I looking up? A cell, usually on the same row.
  2. Where's the table? It must start with the column you're searching in. Lock it with $ if you'll copy the formula.
  3. Which column has the answer? Count from the first column of the table, which is 1.
  4. Exact match? Almost always FALSE (or 0). TRUE is only for bands, like grade boundaries.

Worked example

ABCDEF
1CodeItemPriceCodeQty
2A1Tea2.1C34
3B2Coffee2.6A12
4C3Juice1.8D41
5D4Water0.9X93
6E5Soup3.4
  1. =VLOOKUP(E2,$A$2:$C$6,3,FALSE) in G2. Look up the code in E2 (C3) in the table A2:C6, and bring back column 3, the price: 1.8.
  2. =F2*VLOOKUP(E2,$A$2:$C$6,3,FALSE) in H2. A VLOOKUP gives a value like any other, so you can multiply by it: 4 juices at 1.80 is 7.2.
  3. =IFERROR(VLOOKUP(E5,$A$2:$C$6,2,FALSE),"Unknown") in G5. X9 isn't in the table, so VLOOKUP gives #N/A. IFERROR shows Unknown instead.

Letting MATCH pick the column

A typed-in column number breaks when someone wants a different column, or inserts a new one. MATCH(heading, header row, 0) finds the column number for you.

Give MATCH the header row of the whole table, starting at the same column as the VLOOKUP table, so the numbers line up: =VLOOKUP(F1,A2:D6,MATCH(F2,A1:D1,0),FALSE).

What you'll practise

  1. In D2, look up the unit price of each order's product in the price list in G2:H9, then copy it down to D13.
  2. In I2, use VLOOKUP to show the phone extension of the person whose staff ID is in I1.
  3. Visitors' badges are checked against today's list in G2:H9. In B2, look up each visitor's host. Some badges aren't on the list: show Not found for those instead of #N/A.
  4. In C2, work out each line total: the quantity times the price of that item, looked up in F2:G8. Do it in one formula, then copy it down.
  5. In J3, show the number of visitors for the site in J1 in the month in J2. Use MATCH inside VLOOKUP to find the month's column, so it works for any month.

Guides with worked examples: VLOOKUP not working: 6 common problems and how to fix them · VLOOKUP: a simple worked example · #N/A in Excel: what it means and how to fix it · VLOOKUP from another sheet in Excel · The #REF! error in Excel: what it means and how to fix it