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.
- LearnRead the guide and its worked examples.
- PractiseA drill on just this skill, easier tasks first. Stuck? “Show me how”.
- TestA timed mock in the style your employer named.
- 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)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Code | Product | Price | Find | Price |
| 2 | P101 | Stapler | 4.50 | P103 | 7.80 |
| 3 | P102 | Ring binder | 2.25 | ||
| 4 | P103 | Desk tray | 7.80 | ||
| 5 | P104 | Whiteboard pen | 1.20 |
=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)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Sales from | Rate | Sales | Rate | |
| 2 | 0 | 0.02 | 6,200 | 0.05 | |
| 3 | 1,000 | 0.03 | |||
| 4 | 5,000 | 0.05 | |||
| 5 | 10,000 | 0.07 |
=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
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | ID | Name | Dept | Find ID | Dept |
| 2 | 1,041 | Priya Shah | Finance | 1,043 | HR |
| 3 | 1,042 | Tom Reid | Sales | 1,099 | Not found |
| 4 | 1,043 | Ana Costa | HR | ||
| 5 | 1,044 | Lee Wong | IT |
=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)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Staff ID | Find ID | Name | |
| 2 | Priya Shah | 1,041 | 1,042 | Tom Reid | |
| 3 | Tom Reid | 1,042 | |||
| 4 | Ana Costa | 1,043 |
=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
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Staff ID | Find ID | Name | |
| 2 | Priya Shah | 1,041 | 1,043 | Ana Costa | |
| 3 | Tom Reid | 1,042 | |||
| 4 | Ana Costa | 1,043 |
=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
- Leaving out the last argument of VLOOKUP. It then defaults to approximate match and can return a wrong value with no error. Write FALSE for exact matches.
- Counting the column number from column A of the sheet instead of the first column of the table. If the table is C2:F20, column C is 1.
- Forgetting the $ signs on the table, so it slides down as you fill and later rows show #N/A.
- Using approximate match (TRUE) on a band table that isn't sorted smallest to largest.
- Looking for a number stored as text (or the other way round). 1043 and "1043" don't match.
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.