#N/A
A lookup couldn’t find what it was asked to find.
- Excel error
- The fix is practised in 4 lessons
The error, and the fix
E2=XLOOKUP(D2,A2:A4,C2:C4)
| Row | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| 1 | Code | Course | Seats | Find | Lookup | With a fallback |
| 2 | C-04 | Budgets | 12 | C-07 | ||
| 3 | C-05 | Payroll | 3 | |||
| 4 | C-06 | Forecasts | 8 |
C-07 isn’t in the list, so the plain lookup shows #N/A. The fourth argument says what to show instead.
Why it happens, and how to fix it
- The value isn’t in the list
- Check the spelling, or that the item has been added. When a missing item is normal, show a message instead with XLOOKUP’s fourth argument, or wrap the lookup in IFNA.
- Hidden spaces
- “C-07 ” with a space at the end doesn’t match “C-07”. Clean the codes with TRIM, or trim the value you look up: TRIM(D2).
- A number stored as text
- 1024 typed as text doesn’t match the number 1024. Text sits on the left of a cell by default and numbers on the right; make both the same type.
- VLOOKUP without FALSE
- Left out, VLOOKUP’s last argument asks for an approximate match, which needs a sorted list. On an unsorted list it can give #N/A or the wrong row. Add FALSE, or use XLOOKUP, which matches exactly unless told otherwise.
- A range that moved when copied
- Copied down without $, A2:A6 becomes A3:A7 and misses the first row. Lock it as $A$2:$A$6 (press F4).
Questions
How do I hide #N/A in Excel?
Say what to show instead: =XLOOKUP(D2,A2:A4,C2:C4,"Not found"), or =IFNA(VLOOKUP(D2,A2:C4,3,FALSE),"Not found") in versions without XLOOKUP. If the item should have been found, fix the cause first.
What is the difference between IFNA and IFERROR?
IFNA catches only #N/A, the error a lookup gives when nothing matches. IFERROR catches every error, so it can also hide a typo or a broken reference you would want to see.
Practise the fix
Real tasks in a spreadsheet, checked on changed data, so your fix has to work on data you can’t see.
Try it nowStop it happening
- Decide what a missing item should show, and say so with XLOOKUP’s fourth argument or IFNA.
- Use IFNA rather than IFERROR around a lookup: IFERROR also hides a misspelt function or a broken reference.
- Keep codes in one format: no extra spaces, and all text or all numbers.