Lookups

Why VLOOKUP Returns the Wrong Value

Why VLOOKUP returns a wrong value instead of an error, and the usual causes: approximate match, column numbers, duplicates, copied ranges and text numbers.

On this page
  1. The last argument is left out or set to TRUE
  2. The column number is off
  3. The lookup column is not on the left
  4. The first match is not the one you wanted
  5. The range stops too early
  6. The range moves when the formula is copied
  7. Numbers and text that look the same
  8. Once the causes are ruled out

VLOOKUP rarely reports a wrong result as an error. It returns whatever it finds first, so a formula that is wrong can look completely normal. The causes below are the ones that come up most often. Each one has a quick check.

The last argument is left out or set to TRUE

If the last argument is omitted or TRUE, VLOOKUP looks for the nearest value at or below the lookup value instead of an exact match. On a list that is not sorted, that can return a row that looks close but is simply wrong. Type FALSE as the last argument. The difference is explained in vlookup exact match vs approximate match.

The column number is off

The column number counts from the first column of the range you selected, not from column A of the sheet. If your range starts at column B, then 2 means column C. Check the number against the range itself.

Inserting a column inside the range also causes trouble. The range grows to include the new column, but the column number stays the same, so the formula now returns a different column than before. Recheck the number after you change the layout.

The lookup column is not on the left

VLOOKUP only searches the first column of its range. If your codes are in column B and the names you want are in column A, the formula searches the names for the code. That usually gives #N/A, but if the code happens to appear in column A, you get the wrong row.

The fix is to use a formula that does not need the match column on the left. INDEX with MATCH and XLOOKUP both work. For the options, see how to look up a value to the left in excel.

The first match is not the one you wanted

If the lookup value appears more than once, VLOOKUP returns the first match. A product code listed twice, with an old price in the higher row, returns that old price. Excel also treats uppercase and lowercase letters as the same, so “ABC-1” and “abc-1” count as duplicates.

To find repeated values, put this in a spare column next to the list, filled down:

=COUNTIF($A$2:$A$50, A2)>1

It returns TRUE for every value that appears more than once.

The range stops too early

If the range is $A$2:$C$20 but the list runs to row 50, rows 21 to 50 are never searched. Those prices will not show up, and the formula may return #N/A for them. Extend the range to the last row, use a whole-column reference such as A:C, or turn the list into a table and use its name, as shown in how to use vlookup step by step.

The range moves when the formula is copied

If the table range has no dollar signs, copying the formula moves the range with it. A formula in F2 that uses A2:C50 becomes A3:C51 in F3, so the first row of the list is no longer searched and an extra row is added at the bottom. The results can look plausible but be off by a row.

Lock the range with dollar signs before you copy it, as in $A$2:$C$50. For the syntax, see how to lock cell reference in excel. For related problems when copying, see why does copied formula give wrong result in excel.

Numbers and text that look the same

A code typed as text, such as “1001” in a text-formatted cell, does not match the number 1001. The same goes for codes with a trailing space. Text numbers are often aligned to the left of the cell and true numbers to the right, which can be a useful hint.

To fix a list of text numbers, convert them with VALUE, or see how to convert text to number in excel. To remove extra spaces, wrap the lookup value in TRIM, such as TRIM(E2). TRIM does not remove every kind of space, though. Spaces pasted from websites are often non-breaking spaces. For those, see remove non printing characters in excel.

Once the causes are ruled out

Check the value you are looking for, not only the formula. Copy it from the source list and paste it into the formula, which rules out hidden spaces and similar small differences. If the formula still returns an error, the cause is more likely a missing value than a wrong formula. For that case, see what does #n/a mean in excel.

The complete guide to lookups

How to Look Up Data in Excel
Read the guide

Keep exploring

Guides from other topics

All topics →