A VLOOKUP that returns #N/A for a code that is plainly in the list usually has a data problem, not a formula problem: a number stored as text, a trailing space, or the wrong column number. Work through the causes in order instead of wrapping the error away.
What you need
- Excel with the VLOOKUP and its lookup table
- The lookup value that returns #N/A
- A note of which column the lookup should return
Step 1: Check the lookup value against the list
Compare the lookup value with the list entry character by character using =A2=B2 and =LEN(A2). A trailing space or a non-breaking space makes two identical-looking values different, and the lookup fails.
Step 2: Check the types on both sides
Confirm the lookup value and the first column of the table are the same type. A number stored as text will not match a real number; convert the text with VALUE or Text to Columns and try again.
Step 3: Check the column number and the exact match flag
Confirm the column number is within the table and the fourth argument is FALSE for an exact match. A column number beyond the table returns #REF!, and an approximate match on unsorted data returns the wrong row.
Worked example: synthetic price lookup for code B-210
The table below is a synthetic example. It shows the expected result of diagnosing a failed VLOOKUP; no workbook was opened.
| Check | Finding | Result |
|---|---|---|
| Code in the list? | Yes, B-210 is listed | List is fine |
| Lookup value length | 6, list value is 5 | Trailing space found |
| After TRIM | B-210 matches | Price returned |
| Column number | 2 of 2 | Within the table |
Expected result (UNTESTED). the code is in the list, but the lookup value has a trailing space, so its length is 6 against 5 in the list. After TRIM, the lookup matches and returns the price. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Do not hide a #N/A with IFERROR until you know why it appears; it may be a real data error.
- VLOOKUP only looks to the right; use XLOOKUP or INDEX-MATCH when the return column is on the left.
- An approximate match needs the first column sorted; use FALSE for an exact match unless you mean otherwise.
