What you will learn
- Catch #N/A from VLOOKUP
- Show your own message instead
How it works
=IFERROR(VLOOKUP(A2,$F$2:$G$5,2,FALSE),"Not found")
If VLOOKUP works, you see the answer. If not, you see "Not found".
Formulas at a glance
=IFERROR(VLOOKUP(…),"Not found") | The pattern to follow |
Example
Write the formula to look up the product for code B-2. Show "Not found" if it is missing.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Qty | Product | Code | Product | ||
| 2 | B-2 | 3 | B-1 | Book | |||
| 3 | B-7 | 1 | B-2 | Bag | |||
| 4 | B-1 | 5 | B-3 | Bottle | |||
| 5 | B-3 | 2 | B-4 | Box |
Click C2 and type =IFERROR(VLOOKUP(A2,$F$2:$G$5,2,FALSE),"Not found"), then press Enter.
The answer is Bag.
When to use it
- Order sheets where some codes are new
- Reports for people who don’t know what #N/A means
- Checking which codes are missing
Common mistakes
- Putting IFERROR inside VLOOKUPIFERROR goes on the outside.
- Hiding a typo in the codeCheck the "Not found" rows. The code may be misspelled.
- Forgetting the quotes on the messageWrite "Not found" in quotes.
Practice it on a real sheet
Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.