DATA CLEANUP & ERROR CHECKS

VLOOKUP Not Working? 7 Fixes (Numbers Stored as Text, Spaces and More)

VLOOKUP fails in two ways. The loud way is #N/A, even though you can see the value right there in the table. The quiet way is worse: it returns a believable but wrong number. This guide walks through the seven causes behind almost every broken VLOOKUP, shows the broken formula next to the fixed one, and ends with a checklist you can run on any lookup.

VLOOKUP not working in Excel: a number stored as text and an extra space both return #N/A, while the fixed formula =VLOOKUP(--H5,...,FALSE) returns 15.00 and the trimmed Desk Lamp lookup returns 48.00.
Broken lookups on the left, the fixed formulas and their results on the right.

What you will build

The practice file has a small product list and seven problem cases, each with the broken formula and the fixed one side by side:

AreaCellsWhat it holds
Product listA3:D11ID, Product, Category and Price for eight products, sorted by ID (inputs)
Problem casesF3:J10Problem, lookup value (input), broken formula and fixed formula
CheckJ12Confirms none of the fixed formulas returns an error
Free download: Get the VLOOKUP fixes workbook (.xlsx) and follow along. The Broken column is meant to show errors and wrong answers. Everything works in Excel 2010 and later; the XLOOKUP alternatives need Microsoft 365 or Excel 2021 and later.
SymptomMost likely fix
#N/A, value is visibly thereFix 2 (text vs number) or Fix 3 (spaces)
A wrong but believable numberFix 1 (missing FALSE) or Fix 4 (column number)
#N/A only on some rows after copyingFix 6 (lock the range)
The formula itself shows in the cellFix 7 (Text format)
#N/A, answer is left of the keyFix 5 (INDEX/MATCH or XLOOKUP)
Start with the symptom you see.

Fix 1: Add FALSE for an exact match

VLOOKUP's fourth argument, range_lookup, is optional, and if you leave it out Excel uses approximate match. On an ID list that means: if the ID is not there, return the row with the next smaller ID. In I4:

=VLOOKUP(H4,$A$4:$D$11,4)

ID 1009 does not exist, but the formula returns 29.75, the price of the Cable Tray (ID 1008). No error, just a wrong answer. Add FALSE (or 0) to force an exact match, and wrap it in IFNA so a missing ID says so. In J4:

=IFNA(VLOOKUP(H4,$A$4:$D$11,4,FALSE),"Not found")
Excel VLOOKUP without FALSE returning 29.75 for ID 1009, which does not exist, while =IFNA(VLOOKUP(H4,$A$4:$D$11,4,FALSE),"Not found") returns Not found.
Without FALSE, a missing ID quietly borrows the price of the row above.
Why this one is dangerous: When the ID does exist, both versions return the same answer, so the mistake can sit in a price list or an invoice for months. Approximate match is only right for ranges such as tax brackets or commission tiers, and then the table must be sorted smallest first.

Fix 2: Numbers stored as text

The IDs in column A are numbers. The lookup value in H5 came from a CSV export and is the text 1004. You can spot it because it is left-aligned and Excel shows a small green triangle. To VLOOKUP, the number 1004 and the text "1004" are different values, so =VLOOKUP(H5,$A$4:$D$11,4,FALSE) returns #N/A. Convert the lookup value inside the formula. In J5:

=VLOOKUP(--H5,$A$4:$D$11,4,FALSE)

The double minus turns text that looks like a number into a number (VALUE(H5) does the same). If it is the other way round, with numbers in the cell and text in the table, use H5&"" to turn the lookup value into text. The lasting fix is to clean the column once: fix numbers stored as text shows four ways.

Excel VLOOKUP returning #N/A because the lookup value 1004 is stored as text, fixed with =VLOOKUP(--H5,$A$4:$D$11,4,FALSE) returning 15.00.
The text 1004 never matches the number 1004.
Checkpoint: J5 returns 15.00, the price of the Notebook Set.

Fix 3: Extra spaces

H6 says Desk Lamp, but it was typed with a trailing space: "Desk Lamp ". To Excel that is a different value, so the broken formula returns #N/A. TRIM removes leading, trailing and repeated spaces. In J6:

=VLOOKUP(TRIM(H6),$B$4:$D$11,3,FALSE)

Use =LEN(H6) to check: Desk Lamp has 9 characters, so a length of 10 gives the space away. If TRIM does not help, the culprit is usually a non-breaking space from a web page or PDF (CHAR(160)), which TRIM ignores: use SUBSTITUTE(H6,CHAR(160),""). Remove extra spaces and hidden characters and find nonprinting characters cover the rest.

Excel VLOOKUP returning #N/A for Desk Lamp with a trailing space, fixed with =VLOOKUP(TRIM(H6),$B$4:$D$11,3,FALSE) returning 48.00.
One invisible space is enough to break the match.
Checkpoint: J6 returns 48.00.

Fix 4: The wrong column number

col_index_num counts columns from the left edge of the table range, not from column A of the sheet. In this table Price is column 4, so =VLOOKUP(H7,$A$4:$D$11,3,FALSE) returns Accessories from the Category column. Hard-coded numbers also break when someone inserts a column. Let MATCH find the column by its header. In J7:

=VLOOKUP(H7,$A$4:$D$11,MATCH("Price",$A$3:$D$3,0),FALSE)
Excel VLOOKUP with column 3 returning Accessories instead of a price, fixed with MATCH("Price",$A$3:$D$3,0) as the column number to return 72.00.
MATCH turns a header name into the right column number.
Checkpoint: J7 returns 72.00 for the Monitor Arm. Change H7 to 1005 and it returns 420.00 while the broken version shows Desks.

Fix 5: The answer is to the left of the lookup column

VLOOKUP always searches the first column of the table and can only return columns to its right. To find the ID (column A) for a product name (column B), =VLOOKUP(H8,$A$4:$D$11,1,FALSE) searches column A for "Monitor Arm" and returns #N/A. Use INDEX/MATCH instead. In J8:

=INDEX($A$4:$A$11,MATCH(H8,$B$4:$B$11,0))

MATCH finds the row of Monitor Arm in column B, and INDEX returns the value from that row of column A. In Microsoft 365, =XLOOKUP(H8,$B$4:$B$11,$A$4:$A$11) does the same in one step; see how to use XLOOKUP and INDEX MATCH vs XLOOKUP to pick one. For lookups across rows and columns at once, see the two-way lookup with INDEX MATCH.

Excel VLOOKUP returning #N/A when the answer is left of the lookup column, fixed with =INDEX($A$4:$A$11,MATCH(H8,$B$4:$B$11,0)) returning ID 1003 for Monitor Arm.
INDEX/MATCH can return a column to the left of the one it searches.
Checkpoint: J8 returns 1003.

Fixes 6 and 7: Lock the range, and un-format Text cells

Fix 6. If you write =VLOOKUP(H4,A4:D11,4,FALSE) in row 4 and copy it down, the table range moves with it. Five rows down it has become A9:D16, which no longer contains ID 1002, so I9 returns #N/A. Lock the range with dollar signs, $A$4:$D$11 (select the range in the formula and press F4), and every copy points to the same table.

Fix 7. I10 shows =VLOOKUP(H10,$A$4:$D$11,4,FALSE) as text instead of a result. The cell was formatted as Text before the formula was typed, so Excel stored it as a string. Set the format to General (Ctrl+1 > Number > General), then press F2 and Enter to re-enter the formula. If every formula in the sheet shows as text, Show Formulas is on: press Ctrl+` (the key left of 1) to switch it off.

Excel VLOOKUP copied without dollar signs so the range slid to A9:D16 and returns #N/A, and a Text-formatted cell showing the formula, both fixed to return 185.00 and 24.50, with a check showing All fixed.
An unlocked range slides down when copied; a Text cell never calculates.
Ready-to-share test: Change H4 to 1007. The broken formula in I4 and the fixed formula in J4 now both return 39.00, and J12 still shows All fixed. That is exactly why a missing FALSE survives testing: it only goes wrong for IDs that are not in the list. Change H4 back to 1009 when you are done.

More reasons a VLOOKUP returns the wrong result

What you seeLikely causeFix
Correct formula, old resultCalculation is set to ManualFormulas > Calculation Options > Automatic, or press F9.
New rows are never foundThe table range stops above themTurn the table into an Excel Table (Ctrl+T) and refer to it by name.
Returns the first of several matchesThe key is duplicatedVLOOKUP returns the first match only; flag the duplicates first.
#N/A with datesOne side is a date, the other is textConvert both to real dates with DATEVALUE.
#REF!col_index_num is larger than the number of columnsCount the columns in the table range, or use MATCH.
#VALUE!col_index_num is less than 1, or the lookup value is longer than 255 charactersUse a positive column number; use INDEX/MATCH for long text.

In a bank reconciliation, where references come from two different systems, text numbers and spaces are the usual reason lines fail to match. Clean the keys first and most #N/A results disappear.

Frequently asked questions

Why does VLOOKUP return #N/A when the value exists?

Almost always because the two values are not truly identical: one is a number and the other text (Fix 2), or one has an extra or non-breaking space (Fix 3). Test with =H5=A7, which returns FALSE when they only look the same.

Should I use IFERROR or IFNA around VLOOKUP?

IFNA. It only catches #N/A (value not found) and lets real problems such as #REF! or #VALUE! show. IFERROR hides every error, including a broken formula.

Is VLOOKUP case-sensitive?

No. VLOOKUP treats DESK LAMP and Desk Lamp as the same. For a case-sensitive lookup, use INDEX/MATCH with EXACT inside an array formula, or XLOOKUP with EXACT.

Is TRUE or FALSE the default?

TRUE (approximate match) is the default when the fourth argument is left out. Always type FALSE or 0 for IDs, names and codes.

Should I switch to XLOOKUP?

If everyone who opens the file has Microsoft 365 or Excel 2021 and later, yes: XLOOKUP is exact-match by default, can look left and has a built-in if_not_found argument. See how to use XLOOKUP in Excel.

Final checklist

  • The fourth argument is FALSE (or 0) for IDs, names and codes.
  • The lookup value and the first column are the same type: both numbers or both text.
  • No leading, trailing or non-breaking spaces (check with LEN).
  • The column number points at the right column, or MATCH finds it by header.
  • The answer is to the right of the lookup column, or INDEX/MATCH or XLOOKUP is used.
  • The table range is locked with $ and covers every row.
  • The formula cell is not formatted as Text, and Show Formulas is off.

Ready to move on from VLOOKUP? XLOOKUP exact match removes fixes 1, 4 and 5 entirely.

Practice file: Download the VLOOKUP fixes workbook. The “How It Works” sheet lists every fixed formula and what it does.

Stop fighting your lookups

Browse the OneXcel Tutorial Hub for more troubleshooting guides, explore ready-to-use Excel templates with clean lookups built in, or turn your data into a dashboard with the OneXcel Dashboard Builder.