Excel IFERROR Practice Question: Product IDs to price are in A2:A7 and the price list is in D2:E6. Show the…
The question
Product IDs to price are in A2:A7 and the price list is in D2:E6. Show the price in G2:G7, or the text Not found when the ID is not in the list.
The data
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Product ID | Product ID | Unit price | Price | |||
| 2 | P-102 | P-101 | 450 | ? | |||
| 3 | P-109 | P-102 | 1250 | ? | |||
| 4 | P-105 | P-103 | 299 | ? | |||
| 5 | P-107 | P-104 | 780 | ? | |||
| 6 | P-101 | P-105 | 2150 | ? | |||
| 7 | P-104 | ? |
The yellow cells are where your answer goes.
Show answer
Expected results:
- G2 = 1250
- G3 = Not found
- G4 = 2150
- G5 = Not found
- G6 = 450
- G7 = 780
How it works
Explanation: IFERROR returns your own message when the formula inside gives an error. A missing ID makes VLOOKUP return #N/A, which IFERROR replaces.
Syntax: =IFERROR(VLOOKUP(A2,$D$2:$E$6,2,FALSE),"Not found")
P-109 and P-107 are not in the list, so they show Not found.
Try it yourself in the live sheet
Type your formula in the highlighted cell and get instant feedback. Free, no Excel install needed.
Try this question in the live sheet →IFERROR syntax
Runs a formula, but shows a fallback value instead of an error if it fails. IFERROR is used to build decision rules directly into a spreadsheet instead of manually judging each row. Full IFERROR guide.
More IFERROR practice questions
- Divide the sales by the units for each row, but show 0 when the units are 0. Put it in…
- Look up the price of each item in the table (D2:E4). Show Not found if the item is not…
- The values are typed as text. Turn each into a number, and show 0 if it is not a number.…
- Find the growth (this year minus last year, divided by last year). Show New when last…
- Find the average of the three marks in B to D for each student. Show No marks when the…
- Look in list 1 (C2:D3) first, then in list 2 (E2:F3), and show Not found if the code is…
- Divide each sales figure in column A by the units in column B, treat the errors as 0,…
- Each note may contain a reference like #101. Take the number after the # sign, or show…
All practice questions · Excel exercises · Interview prep · Cheat sheet