Practice problems / Data Cleaning

Handle missing SKUs in a lookup (IFERROR)

Medium Data Cleaning
Description
Hints 0/4
Solutions 2
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

The problem

Problem statement

Customer service forwarded an order list, and one of the SKUs was discontinued — it is not in the price list (A2:C6) anymore, so a plain lookup would blow up with an error in the middle of your report. Fill the Unit price cells F2:F4 so every order row either shows the matched price or the text Not found.

Wrap the lookup rather than replacing it — case 2 is a discontinued SKU and must show "Not found" instead of #N/A.

Problem data

Show the sheet as a table (selectable, copyable)
The exercise data, as a table
ABCEF
1 SKUProductUnit priceOrder SKUUnit price
2 SKU-101Keyboard199SKU-103
3 SKU-102Mouse89SKU-999
4 SKU-103Monitor899SKU-101
5 SKU-104Laptop stand149
6 SKU-105USB hub259

Notes

IFERROR(value, value_if_error) wraps any formula and replaces its errors (#N/A, #REF!, #DIV/0!) with a fallback. Scoping note: it also hides genuine mistakes like a typo'd range, so use it at the edges of a report, not while debugging.

How to approach

Your answer goes in F2:F4. On submit we re-run your formula against 3 different sets of input, so a hardcoded number will fail — the formula has to follow the cells.

  1. Target cells are F2:F4 — start in F2, then fill down
  2. Build the working lookup first: E2 against the price table A2:C6, price in column 3
  3. Then wrap the whole lookup in a function that catches errors
  4. The fallback text is "Not found" — quotes required

Official solutions

Show 2 solutions — try it yourself first

Approach 1: IFERROR around VLOOKUP

=IFERROR(VLOOKUP(E2, A2:C6, 3, FALSE), "Not found")

The VLOOKUP runs first. If the SKU is missing, it raises #N/A; IFERROR catches that and returns the text "Not found" instead. Fill down through F4.

Approach 2: IFNA for lookup misses only

=IFNA(VLOOKUP(E2, A2:C6, 3, FALSE), "Not found")

IFNA catches only #N/A — the 'not found' error — and lets other errors (typos, broken references) surface loudly. Often the better choice in production reports.

Function guide

Related practice

FAQ

How do I hide #N/A from VLOOKUP?

Wrap it: =IFERROR(VLOOKUP(E2, A2:C6, 3, FALSE), "Not found"). When the lookup misses, IFERROR returns the fallback text instead of the error.

IFERROR or IFNA — which should I use?

IFNA only catches #N/A (missing lookup values) and still surfaces other errors. IFERROR silences every error, which can mask real mistakes. For lookup fallbacks, IFNA is the more precise tool.

Does IFERROR slow down large sheets?

Marginally — it evaluates the inner formula and checks the result. On report-sized ranges it is negligible; on whole-column array formulas it adds up.