VLOOKUP looks for a value in the first column of a range and returns what’s in another column of the same row. #N/A is its way of saying “I didn’t find it”. In an office this typically happens with an orders sheet that matches codes against a product list exported from the business system: on screen the two codes look identical, but to Excel they aren’t. Before rewriting the formula, find out what the difference is — the rest of this article follows that order.

In this article
- First, find out why Excel thinks they’re different
- 1. Spaces and invisible characters
- 2. A number on one side, text on the other
- 3. The fourth argument was left empty
- 4. A wrong range, or one that “moved”
- 5. An asterisk or question mark in the lookup value
- The value really isn’t there
- VLOOKUP between files in a network folder
- When to switch to XLOOKUP
- Frequently asked questions
First, find out why Excel thinks they’re different
Pick a row that returned #N/A, locate in the table the code that should have been found, and run two checks in an empty column:
- Compare the two cells directly, for example
=A3=D5. If the result is FALSE, there’s a difference you can’t see. - Count the characters in each one with
=LEN(A3)and=LEN(D5). Different lengths point to a space or a hidden character; equal lengths with a FALSE comparison usually mean a number on one side and text on the other.

With that diagnosis in hand, go straight to the matching cause.
1. Spaces and invisible characters
Files exported from ERP or invoicing systems, or copied from web pages, very often carry a space at the end of the code. The TRIM function strips spaces from the start and end (and collapses double spaces in the middle):
=VLOOKUP(TRIM(A2),$D$2:$E$500,2,FALSE)
If the problem is in the table’s column rather than in the lookup value, the safest move is to build a helper column with =TRIM(D2), then copy it and paste it as values over the original.
One case is particularly misleading: the non-breaking space (character 160), common in content copied from websites. The official TRIM function page explains that it only deals with the regular space, so the character count stays higher even after cleaning. In that case, replace the character first:
=TRIM(SUBSTITUTE(A2,CHAR(160),""))
2. A number on one side, text on the other
This is the most common cause when one side came from a CSV file. A cell holding a number stored as text is left-aligned and shows a small green triangle in the corner. To fix it:
- Select the cells in the problem column.
- Click the warning icon that appears next to the selection (or press Alt+Shift+F10).
- Choose Convert to Number.
If the green triangle doesn’t appear on any cell, error checking is switched off on that computer. Open File › Options › Formulas and, under Error Checking, check Enable background error checking, as described in Microsoft’s article on numbers stored as text.

When you can’t change the source sheet (because the system regenerates it every day, say), adjust inside the formula instead: VALUE(A2) turns text into a number, and A2&"" goes the other way.
3. The fourth argument was left empty
VLOOKUP’s last argument sets the type of match. With FALSE (or 0), it only accepts the exact value. If you leave it blank or use TRUE, Excel runs an approximate match, which assumes the first column is sorted in ascending order; with an unsorted table it returns #N/A or, worse, a wrong value without any warning. When matching customer codes, product codes or tax IDs, always use FALSE. Approximate match only makes sense for band tables, such as commission rates by sales amount.
4. A wrong range, or one that “moved”
- VLOOKUP only searches the first column of the range you give it. If the code is in column D, the range starts at D, and the column number is counted from there (D = 1, E = 2).
- Without dollar signs, the range slides down as you drag the formula and leaves the last rows out. Lock it with F4:
$D$2:$E$500. - New rows added below the end of the range fall outside the search. One alternative is to turn the list into a table (Ctrl+T) and use the table’s name in the formula, which grows with new rows.
- If the column number is larger than the number of columns in the range, the result is #REF!, not #N/A — see Excel errors explained.
5. An asterisk or question mark in the lookup value
In VLOOKUP, * and ? act as wildcards, according to the official function documentation. A code such as KIT*2 can match the wrong item. To search for the character literally, put a tilde in front of it: KIT~*2.
The value really isn’t there
Sometimes #N/A is correct: the new customer simply hasn’t been added yet. To keep the report readable, swap the error for a message. Prefer IFNA, which only hides #N/A, over IFERROR, which would also hide a #REF! caused by a broken formula:
=IFNA(VLOOKUP(A2,$D$2:$E$500,2,FALSE),"Not found")
VLOOKUP between files in a network folder
It’s common for an orders workbook to pull data from a list kept in a shared folder on the server or NAS. That works, but the link stores the path to the source file. If a colleague opens the workbook on a PC where the network drive has a different letter, or someone renames or moves the list, the results stop updating or turn into errors. Use the same drive letter on every machine — the walkthrough is in how to map a network drive — and, to repair a link that’s already broken, open the Workbook Links pane on the Data tab (in older versions the command is called Edit Links) and use Change source to point to the right file.
When to switch to XLOOKUP
XLOOKUP removes three of VLOOKUP’s limitations in one go: it searches any column (including ones to the right of the result), it uses exact match by default, and it has its own argument for the “not found” text:
=XLOOKUP(A2,$E$2:$E$500,$D$2:$D$500,"Not found")

The catch is compatibility. The XLOOKUP function page states that it isn’t available in Excel 2016 or Excel 2019. If the office still has machines running those versions, a workbook using XLOOKUP won’t work on them.
| Situation | Best choice |
|---|---|
| Everyone uses Microsoft 365 or Excel 2021/2024 | XLOOKUP |
| Any PC with Excel 2016 or 2019 | VLOOKUP with FALSE |
| Result column to the left of the lookup column, no XLOOKUP | INDEX with MATCH |
Frequently asked questions
VLOOKUP works on my computer but gives #N/A on my colleague’s.
If the formula pulls the list from another file, start with the link: the source path may not exist on their PC (a different drive letter, or no access to the folder), and then the results don’t update or become errors. Open the source file on both computers through the same path and check the workbook links. If the list is in the same workbook, repeat the diagnosis with =A3=D5 and LEN on their PC.
I fixed the spaces and #N/A is still there.
Compare the lengths again with LEN. If there’s still a difference, there’s a non-breaking space or another hidden character; use SUBSTITUTE with CHAR(160). If the lengths match, the problem is the data type: a number on one side and text on the other.
Can I use whole columns, such as D:E, in the range?
Yes, and new rows are then picked up automatically. Just make sure there’s nothing else below the list in those columns, such as totals or notes, because they become part of the search too.