Services

Start a project
Excel and Google Sheets

VLOOKUP not working? Check these six things.

You can see the order number in both lists, yet VLOOKUP says #N/A. Most often, one list has real numbers and the other has numbers stored as text, often from a CSV export or a copy from a website. Here’s how to spot that in seconds, fix it for good, and rule out the other usual causes.

First, find out which problem you have

Say your formula in B2 is =VLOOKUP(A2, Products!A:C, 3, FALSE). Pick one value that fails, find the same value in the lookup table (say it’s in Products!A15), and type these in spare cells:

=ISTEXT(A2)
=ISTEXT(Products!A15)
=LEN(A2)
=LEN(Products!A15)

The first two tell you whether each value is text. The last two count characters: 1042 should give 4.

What the checks sayThe problemJump to
One ISTEXT is TRUE, the other FALSENumbers stored as text on one sideFix 1
A LEN is longer than it should beHidden spaces or other invisible charactersFix 2
Both look the sameOne of the formula mistakesFixes 3 to 6

A small green triangle in the corner of a cell is another hint. In Excel it often means “number stored as text”. Click the cell and the warning icon tells you.

Fix 1: Numbers stored as text

Quick fix in the formula. Make the value you look up match the table:

Table has text, you look up a number:
=VLOOKUP(A2 & "", Products!A:C, 3, FALSE)

Table has numbers, you look up text:
=VLOOKUP(VALUE(A2), Products!A:C, 3, FALSE)

Adding & "" turns a number into text, and VALUE turns text into a number. Both work the same in Google Sheets.

Fix the data itself (better, because every formula then works):

  1. Select the column that holds text numbers.
  2. In Excel, choose Data → Text to Columns and click Finish straight away. Excel re-reads each cell and turns text numbers into real numbers. Or click the green-triangle warning and choose Convert to Number.
  3. In Google Sheets, put =ARRAYFORMULA(IF(A2:A500 = "", "", VALUE(A2:A500))) in an empty column, then copy it and use Edit → Paste special → Values only over the original column.

Careful with codes that need their leading zeros, like ZIP codes 02134 or SKUs 00781. Converting those to numbers drops the zeros. For codes like that, keep both sides as text and use the & "" fix instead.

Fix 2: Hidden spaces and invisible characters

Exports and web copies often add a space at the end, or a “non-breaking space” that TRIM alone doesn’t remove. Clean the value you look up like this:

=VLOOKUP(TRIM(SUBSTITUTE(A2, CHAR(160), " ")), Products!A:C, 3, FALSE)

If the spaces are in the table instead, add a helper column next to it with =TRIM(SUBSTITUTE(A2, CHAR(160), " ")), paste it as values over the original, and delete the helper.

Fix 3: The last argument is missing

=VLOOKUP(A2, Products!A:C, 3) without FALSE does an approximate match. On an unsorted list it returns wrong answers without any error, which is worse than #N/A. Always end with FALSE (or 0) when you want an exact match.

Fix 4: The table moved when you copied the formula down

If the formula in row 2 says A2:C100 but the one in row 50 says A50:C148, the top of the table slid out of range. Lock it with dollar signs, $A$2:$C$100, or use whole columns, Products!A:C.

Fix 5: You’re looking to the left

VLOOKUP only searches the first column of the range and only returns columns to its right. If the order number is in column C and you want the customer in column A, use XLOOKUP (Excel 365 and 2021, and Google Sheets):

=XLOOKUP(A2, Orders!C:C, Orders!A:A, "Not found")

In older Excel, use INDEX and MATCH: =INDEX(Orders!A:A, MATCH(A2, Orders!C:C, 0)).

Fix 6: The column number is off

The 3 in VLOOKUP(A2, Products!A:C, 3, FALSE) counts from the first column of the range, not from column A of the sheet. If your range starts at column B, column D is number 3. If you get #REF!, the number is bigger than the range is wide.

One more tip: don’t hide the error too early

Wrapping everything in IFERROR(..., "") makes the sheet look clean, but it also hides every mistake above. Fix the data first, then use IFNA(..., "Not found"). That only covers the “not in the list” case, so real formula errors still show up.

Lookups breaking every time you import a report?

Send me a copy of the file. I’ll turn numbers stored as text into real numbers, fix mixed dates and extra spaces, remove duplicates and repair the lookups. Your original is never changed.