The #N/A error means "not available": VLOOKUP could not find the value you asked for. Sometimes that is correct because the value really is missing. But very often the value is there, and something small stops VLOOKUP from seeing it. This guide walks through the six most common causes and the exact fix for each one.
All examples use this small product table in A1:C6:
| A: Product ID | B: Product | C: Price | |
|---|---|---|---|
| 2 | P-101 | Wireless Mouse | $24.99 |
| 3 | P-102 | USB-C Hub | $39.50 |
| 4 | P-103 | Laptop Stand | $32.00 |
| 5 | P-104 | Webcam 1080p | $54.90 |
| 6 | P-105 | Desk Lamp | $27.75 |
1. The value really does not exist
If you look up P-110, VLOOKUP correctly returns #N/A because there is no such ID. In that case, the error is not a bug. Show a friendlier message with IFNA:
=IFNA(VLOOKUP(E2,$A$2:$C$6,3,FALSE),"Not found")
This returns Not found instead of #N/A. Prefer IFNA over IFERROR: IFERROR hides every error, including real mistakes like a wrong column number, while IFNA only catches "not found".
2. Extra spaces in the lookup value or the table
This is the most common cause. A value copied from another system often carries a hidden trailing space, so "P-103 " does not match "P-103".
Fix: wrap the lookup value in TRIM, which removes leading and trailing spaces:
=VLOOKUP(TRIM(E2),$A$2:$C$6,3,FALSE)
In our test, the plain formula returned #N/A and the TRIM version returned $32.00. If the extra spaces are inside the table instead, clean that column once (for example with a helper column using TRIM, then paste the results as values).
Tip: data copied from websites sometimes contains a non-breaking space that TRIM does not remove. Use SUBSTITUTE(E2,CHAR(160),"") to strip it.
3. Numbers stored as text (or text stored as numbers)
To Excel, the number 1003 and the text "1003" are different values. If your IDs are numbers in the table but the lookup value is text (or the other way around), VLOOKUP returns #N/A even though they look identical. A small green triangle in the corner of a cell is a common sign of a number stored as text.
For example, suppose employee IDs 1001, 1002 and 1003 are stored as numbers in A10:A12 with names in B10:B12, and E10 contains the text "1003".
Fix: convert the lookup value to match the table.
- Text lookup value, numbers in the table:
=VLOOKUP(VALUE(E10),$A$10:$B$12,2,FALSE) - Number lookup value, text in the table:
=VLOOKUP(E10&"",$A$10:$B$12,2,FALSE)
4. Approximate match is turned on by accident
VLOOKUP's fourth argument decides the match type. If you leave it out, Excel uses approximate match (TRUE). On unsorted data that can return the wrong row or an #N/A error.
Fix: for IDs, names and codes, always add FALSE as the last argument:
=VLOOKUP(E2,$A$2:$C$6,3,FALSE)
5. The lookup value is not in the first column
VLOOKUP only searches the leftmost column of the table you give it. If you try to find a product name in a table that starts with the ID column, it will never match.
Fix: start the range at the column you are searching, or switch to XLOOKUP, which can look in any column and return from any other:
=XLOOKUP(E2,B2:B6,A2:A6,"Not found")
6. The table range shifted when you copied the formula
If you write A2:C6 without dollar signs and drag the formula down, the range moves too: A3:C7, A4:C8, and so on. Lower rows then fall outside the table and return #N/A.
Fix: lock the range with absolute references, $A$2:$C$6. Select the range in the formula bar and press F4 to add the dollar signs quickly.
Quick troubleshooting checklist
| Symptom | Likely cause | Fix |
|---|---|---|
| Value is clearly missing | Genuine no-match | IFNA(…, "Not found") |
| Values look identical | Extra spaces | TRIM / SUBSTITUTE CHAR(160) |
| Numbers look identical | Number vs text | VALUE() or &"" |
| Wrong or random results | Approximate match | Add FALSE |
| Never matches | Searching the wrong column | Use XLOOKUP |
| Works at the top, fails lower down | Range not locked | Use $A$2:$C$6 |
Frequently asked questions
Should I use IFERROR or IFNA?
Use IFNA when you only want to handle "not found". IFERROR also hides errors like #REF! and #VALUE!, which usually point to a real problem in your formula.
Why does VLOOKUP work for some rows but not others?
Usually because of inconsistent data in those rows (spaces or numbers stored as text) or an unlocked range that shifted as you copied the formula.
Is XLOOKUP better than VLOOKUP?
If you have Excel for Microsoft 365, 2021 or later, XLOOKUP is easier: it defaults to an exact match, can search any column, and has a built-in "if not found" argument. See our guide to using XLOOKUP with multiple criteria.
Komentar
Posting Komentar