VLOOKUP Not Working? Every Cause and the Fix for Each

9 min read

If VLOOKUP returns #N/A for a value you can see in the list, the two values aren't really identical: most often one is a number stored as text, or one has a hidden space, and =VLOOKUP(VALUE(TRIM(A2)), Items!$A$2:$E$14, 4, FALSE) fixes both. If it returns a number that's wrong, check the end of the formula first: without FALSE, VLOOKUP uses approximate match and returns a neighbouring row without any error.

Those two cover most cases of VLOOKUP not working. The rest of this guide is a diagnosis table for every other cause, worked through on one example business: Osprey Vet Supply, a fictional distributor of veterinary consumables, looking up unit costs for a reorder. Download the practice workbook (.xlsx). Its Practice sheet has nine VLOOKUPs, each broken in a different way, with a blank column for your fix; the Solution sheet has the fixes, the causes and a quick check for each row.

The one-minute check before anything else

Pick a lookup that fails, find the row in the source list that you're sure it should match, and type a comparison in any empty cell. For Osprey, the item code is in C2 of the reorder sheet and the matching item sits in A4 of the Items sheet:

=C2=Items!A4

If that says FALSE, VLOOKUP is right and your data is wrong: the two cells differ in a way you can't see. Two more formulas tell you how:

  • =ISTEXT(C2) and =ISTEXT(Items!A4). If one says TRUE and the other FALSE, one is text and one is a number.
  • =LEN(C2). If an item code of five digits has a length of 6, there's a hidden character.

If the comparison says TRUE and VLOOKUP still fails, the problem is in the formula: the range, the column number or the last argument. Microsoft's Evaluate Formula tool (Formulas tab, Formula Auditing group) steps through it one part at a time so you can see which piece goes wrong.

Diagnosis by symptom. #N/A: number stored as text, trailing or hidden space, range slid when copied, value left of the lookup column, value missing. Wrong value: no FALSE, column inserted, duplicate code, manual calculation. #REF!, #VALUE!, #NAME? causes
Start from the symptom. The causes in each column are in the order worth checking.

VLOOKUP not working: the diagnosis table

Most causes below can be reproduced in the practice workbook; the numbers in brackets in the Fix column are the matching fault numbers on its Practice sheet.

SymptomCauseHow to confirmFix
#N/ALookup value is text, list holds numbers (or the reverse)ISTEXT differs; text sits at the left of the cellVALUE(C2) in the formula, or convert the column (row 1)
#N/ATrailing or leading spaceLEN is one too longTRIM(C3), plus VALUE if codes are numbers (row 2)
#N/A, TRIM doesn't helpNon-breaking space (character 160)=UNICODE(RIGHT(C4,1)) returns 160SUBSTITUTE(C4, UNICHAR(160), "") (row 3)
#N/A lower down onlyRange not locked; it slid when copiedClick the cell: the range starts below the item you wantAdd dollar signs: Items!$A$2:$E$14 (row 6)
#N/AThe value you have is to the right of the one you wantYour lookup column isn't the first column of the rangeINDEX and MATCH, or XLOOKUP (row 9)
#N/AThe value really isn't in the listCOUNTIF on the list returns 0Add it, or show a message with IFNA
Wrong value, no errorLast argument missing or TRUE, so approximate matchFormula ends with 4) or TRUE)End with FALSE) (row 4)
Wrong value, no errorDuplicate key; first row winsCOUNTIF returns 2 or moreRemove the stale row (row 5)
Wrong value, no errorA column was inserted or deletedResult belongs to the column next doorUse MATCH on the header for the column number (row 7)
Old value that won't updateCalculation set to ManualChanging the source doesn't change the resultSet calculation to Automatic, or press F9
#REF!Column number bigger than the range is wideCount the columns in the rangeCorrect the number (row 8)
#VALUE!Column number below 1, or lookup value over 255 charactersCheck the third argument; check LENFix the number; use INDEX/MATCH for long text
#NAME?Text in the formula without quotes, or a misspelt nameLook for bare words in the formula"10240" in quotes, or retype the name
Formula shows as textThe cell was formatted as Text before you typedThe cell shows =VLOOKUP(… instead of a resultFormat as General, click in the cell, press Enter

Microsoft's own troubleshooting pages for the #N/A error and the #VALUE! error cover the same ground; the VLOOKUP reference lists #REF!, #NAME? and #SPILL!.

#N/A when the value is right there

Numbers stored as text

This is the classic. Osprey's item list holds codes as numbers. The reorder list came from a stock-count export, where the same codes arrived as text. 10240 and "10240" look identical, but VLOOKUP treats them as different values, so it returns #N/A.

Fix it inside the formula with =VLOOKUP(VALUE(C2), Items!$A$2:$E$14, 4, FALSE), which returns $4.20. If the text is in the list rather than the lookup cell, go the other way and turn the number into text: C2&"". Better still, fix the column once. Microsoft's guide to converting numbers stored as text gives three ways: the error indicator's Convert to Number option, the VALUE function in a helper column, or Paste Special with Multiply by 1.

Four cells that look like item codes: the number 10310 finds $9.60; text 10240, text 10310 with a trailing space, and text 10322 with a non-breaking space all return #N/A, with ISTEXT, LEN and the fix for each
Three of these four fail. ISTEXT and LEN show why in seconds.

Spaces you can't see

Exports from tills, accounting tools and web pages often add a space after a code or a name. "10310 " has a length of 6 and doesn't match 10310. TRIM removes leading and trailing spaces; wrap it in VALUE when the list holds numbers: =VLOOKUP(VALUE(TRIM(C3)), Items!$A$2:$E$14, 4, FALSE) returns $9.60.

When TRIM doesn't help, the space is probably a non-breaking one. Microsoft's TRIM reference says it was designed to trim the ordinary space (character 32) and that the non-breaking space, character 160, is a different character that web pages use. Remove it by name: =VLOOKUP(VALUE(SUBSTITUTE(C4, UNICHAR(160), "")), Items!$A$2:$E$14, 4, FALSE) returns $11.40. UNICHAR works in Excel 2016 and later on Windows and Mac. If a whole export is full of these, clean the column once rather than patching every formula; our guide to cleaning data in Excel shows how.

The range slid down

The formula in row 2 worked, so it was copied down. Without dollar signs, Items!A2:E14 became Items!A7:E19 by row 7, and item 10225, which sits in row 3 of the item list, is no longer inside the range. Lock it with dollar signs (press F4 while the cursor is on the range) and copy it down again.

The value you want is to the left

VLOOKUP only searches the first column of the range and only returns columns to its right. Osprey's buyer has a description, "Chlorhexidine scrub 4% 500 ml", and wants the item code from column A. No column number fixes that. Use =INDEX(Items!$A$2:$A$14, MATCH(C10, Items!$B$2:$B$14, 0)), which returns 10610, or XLOOKUP if you have it (Microsoft 365 and Excel 2021 or later).

A number comes back, and it's wrong

These are the dangerous ones, because nothing on the sheet looks broken.

Approximate match. The fourth argument is optional, and when it's missing, Excel uses approximate match. On a sorted list, a code that isn't there returns the row with the next smaller code. Osprey's buyer typed 11150 for an Elizabethan collar; there's no such code, so =VLOOKUP(C5, Items!$A$2:$E$14, 4) returned $3.40, the cost of item 11140. With FALSE it shows #N/A, and with IFNA(…, "Not in item list") it says so in words. Our VLOOKUP guide explains when approximate match is the right choice.

Duplicate keys. Item 10405, 3 ml syringes, appears twice in the list: last year's row at $8.40 above this year's at $8.90. VLOOKUP returns the first, so every reorder line is costed at the old price. Find duplicates with =COUNTIF(Items!$A$2:$A$14, C6) (anything above 1) and delete the stale row. If you can't change the list and you have Microsoft 365 or Excel 2021 or later, =XLOOKUP(C6, Items!$A$2:$A$14, Items!$D$2:$D$14, "Not found", 0, -1) searches from the bottom up and returns $8.90.

The column moved. Someone inserted a Pack size column in the item list. The formula still says column 3, so it now returns 100 (a box of 100) instead of a cost of $12.50. Find the column by its header instead: MATCH("Unit cost", Items!$A$1:$E$1, 0) in place of the 3.

Calculation is set to Manual. A workbook set to manual calculation doesn't update formulas when data changes, and the setting can arrive with a file someone else saved. Microsoft's guide to recalculation options shows where to switch it back to Automatic (File > Options > Formulas); F9 recalculates in the meantime.

Errors that point at the formula itself

  • #REF!: the column number is larger than the number of columns in the range. Osprey's range is five columns wide, so column 6 can't exist. It also appears when a sheet or file the formula refers to has been deleted; see VLOOKUP from another sheet for links that break.
  • #VALUE!: the column number is less than 1, or the lookup value is more than 255 characters. For long text, Microsoft suggests INDEX and MATCH.
  • #NAME?: usually text typed into the formula without quotation marks, such as =VLOOKUP(Gauze, …). It also appears when someone opens a file containing XLOOKUP in Excel 2019 or earlier.
  • #SPILL!: in Microsoft 365, using a whole column such as A:A as the lookup value tries to return a result for every row. Use a single cell, or put @ in front of the column, as the VLOOKUP reference describes.

Two odd ones. If your lookup value contains an asterisk or question mark, VLOOKUP treats them as wildcards with exact match, so "Bandage 10cm*" matches anything starting with "Bandage 10cm". Put a tilde in front (~*) to search for the character itself. And if the formula cell shows the formula as text instead of a result, the cell was formatted as Text when you typed it.

The nine broken lookups in the practice workbook with their broken and fixed results: four #N/A become $4.20, $9.60, $11.40 and $7.80; $3.40 becomes Not in item list; $8.40 becomes $8.90; 100 becomes $12.50; #REF! becomes $5.30; and #N/A becomes item code 10610
The practice workbook's nine faults. Rows 4, 5 and 7 return numbers, so they're the ones that reach a report unnoticed.

Stop it happening next month

Six habits prevent nearly every case of VLOOKUP not working that this guide covers:

  1. End every lookup on codes or names with FALSE.
  2. Lock ranges with dollar signs, or point at a table that grows.
  3. Use MATCH on the header instead of a typed column number.
  4. Clean imported columns once (TRIM, convert to numbers) before you look anything up.
  5. Wrap with IFNA rather than IFERROR, so only "not found" is hidden, then count how many: =COUNTIF(E2:E50, "Not in item list").
  6. Check the key column for duplicates with COUNTIF whenever the list is replaced.

Most broken VLOOKUPs in a small business trace back to the same job: matching an export from one system to a list from another every month, such as stock counts against an item master, or an invoice list exported from one of the QuickBooks reports against a customer list. If that's the work, Parity can build the report from the exports directly. Upload the files as CSV or Excel and it builds a dashboard with headline numbers, charts and a table of what needs attention, and every number is checked against queries on the full dataset before you see it. For stock in particular, our inventory dashboard guide shows what's worth tracking once the lookups work.

Stop rebuilding the same lookups

Upload your stock count and item list, and get a checked dashboard of stock and reorder costs. Build a report from your data free

And the next time you find VLOOKUP not working, go back to the one-minute check: compare the two cells directly, and let ISTEXT and LEN tell you which kind of different they are.

Want to see what Parity builds from your data?

Build a report