Wishing all our customers a happy Halloween

Wishing all our customers a very happy Christmas

Wishing all our customers a happy New YearThe New Year in 10Happy New Year! Wishing all our customers a wonderful

Wishing all our customers a happy Easter

LEARN · SKILL 5 OF 11

Lookups: VLOOKUP, XLOOKUP and INDEX/MATCH

Looking something up in another table, such as a price by its code, is an everyday office job. VLOOKUP works in every version of Excel and in Google Sheets, so it is the one to learn first.

  1. LearnRead the guide and its worked examples.
  2. PractiseA drill on just this skill, easier tasks first. Stuck? “Show me how”.
  3. TestA timed mock in the style your employer named.
  4. ReviewYour report shows what cost marks and what to practise next.

The functions

VLOOKUP =VLOOKUP(lookup_value, table, column_number, FALSE)
Finds lookup_value in the first column of the table and returns the value from the column you name by number. FALSE means exact match.
VLOOKUP (approximate) =VLOOKUP(lookup_value, table, column_number, TRUE)
Finds the band a number falls in. The first column must be sorted smallest to largest.
XLOOKUP =XLOOKUP(lookup_value, lookup_range, return_range, if_not_found)
Looks in one range and returns from another. It can look left and has a built-in "not found" value.
INDEX / MATCH =INDEX(return_range, MATCH(lookup_value, lookup_range, 0))
MATCH finds the row number; INDEX returns the value in that row. Works in every version and can look left.
IFERROR =IFERROR(VLOOKUP(...), "Not found")
Shows your own message instead of #N/A when nothing is found.

Worked examples

Example 1 Find a price by product code (exact match)

E2
ABCDE
1CodeProductPriceFindPrice
2P101Stapler4.50P1037.80
3P102Ring binder2.25
4P103Desk tray7.80
5P104Whiteboard pen1.20
E2 holds =VLOOKUP(D2,A2:C5,3,FALSE) and shows 7.80 (highlighted).

Piece by piece

D2
What to look for: the code P103.
A2:C5
The table. VLOOKUP always searches its first column, A.
3
Return the value from the 3rd column of the table, counting from A. A=1, B=2, C=3, so Price.
FALSE
Exact match only. Use FALSE for codes, names and IDs.

Example 2 Find a commission rate from bands (approximate match)

E2
ABCDE
1Sales fromRateSalesRate
200.026,2000.05
31,0000.03
45,0000.05
510,0000.07
E2 holds =VLOOKUP(D2,A2:B5,2,TRUE) and shows 0.05 (highlighted).

Piece by piece

D2
The sales figure, 6200.
A2:B5
The band table. Column A is sorted smallest to largest; it must be.
2
Return the Rate, the 2nd column.
TRUE
Approximate: find the biggest "Sales from" that is not more than 6200. That is 5000, so the rate is 0.05 (5%).

Example 3 Fill a lookup down and handle missing IDs

E3
ABCDE
1IDNameDeptFind IDDept
21,041Priya ShahFinance1,043HR
31,042Tom ReidSales1,099Not found
41,043Ana CostaHR
51,044Lee WongIT
E3 holds =IFERROR(VLOOKUP(D3,$A$2:$C$5,3,FALSE),"Not found") and shows Not found (highlighted).

Piece by piece

D3
The ID to find. No $ signs, so it moves down a row each time you fill.
$A$2:$C$5
The table, locked with $ signs. Without them, filling down would slide the table to A3:C6 and miss rows.
3, FALSE
Return the Dept column, exact match only.
IFERROR(..., "Not found")
ID 1099 isn't in the table, so VLOOKUP gives #N/A. IFERROR shows "Not found" instead. Row 2 found 1043 and shows HR.

Example 4 Look up a value that sits left of the key (XLOOKUP)

E2
ABCDE
1NameStaff IDFind IDName
2Priya Shah1,0411,042Tom Reid
3Tom Reid1,042
4Ana Costa1,043
E2 holds =XLOOKUP(D2,B2:B4,A2:A4,"Not found") and shows Tom Reid (highlighted).

Piece by piece

D2
The ID to find, 1042.
B2:B4
Where to look: the Staff ID column.
A2:A4
What to return: the Name column. It's to the left, which VLOOKUP can't do.
"Not found"
Shown if the ID isn't there. No IFERROR needed.

Example 5 The same lookup with INDEX/MATCH

E2
ABCDE
1NameStaff IDFind IDName
2Priya Shah1,0411,043Ana Costa
3Tom Reid1,042
4Ana Costa1,043
E2 holds =INDEX(A2:A4,MATCH(D2,B2:B4,0)) and shows Ana Costa (highlighted).

Piece by piece

MATCH(D2,B2:B4,0)
Finds 1043 in B2:B4 and gives its position: 3. The 0 means exact match.
INDEX(A2:A4, 3)
Returns the 3rd value in A2:A4: Ana Costa.
Why use it
It works in every version of Excel and in Google Sheets, and it can look left.

Common mistakes

Excel and Google Sheets

In Excel: XLOOKUP needs Excel 2021 or Microsoft 365. VLOOKUP and INDEX/MATCH work in every version, so tests often still expect VLOOKUP.

In Google Sheets: VLOOKUP, XLOOKUP and INDEX/MATCH all work. VLOOKUP defaults to approximate match here too, so always write FALSE for codes and names.

Now practise it

Reading gets you started; doing it under a clock is what the test checks. Practise this skill on its own, easier tasks first, then take a mock.

Practise in the Excel style Practise in the Google Sheets style

Skill drills come with the 30-day and 90-day passes. No pass yet? Try the free five-task mini-mock, no account needed.