formulastreak

VLOOKUP returns the wrong value: how to fix it

Updated · Checked on a live sheet · Excel and Google Sheets

The most likely fix

A wrong result with no error almost always means VLOOKUP did an approximate match: its last argument was left out, so it defaulted to TRUE and assumed the first column is sorted. Add FALSE as the fourth argument and VLOOKUP returns the exact match, or #N/A if there isn't one.

Fix it yourself

The formula in M2 shows the problem. Edit it to the fixed version and watch the sheet recalculate.

SL-401 is Potting mix, but without FALSE VLOOKUP returns Ceramic pot · edit M2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultM2 = Ceramic pot
GHIJKLM
1SKUProductPriceStockSKUSL-401
2PL-101Fern$9.5040ProductCeramic pot
3PL-104Monstera$34.0012
4PL-107Snake plant$22.0025
5PT-210Terracotta pot$12.5060
6PT-212Ceramic pot$19.0018
7TL-301Watering can$18.009
8SL-401Potting mix$7.2580

Shows the problem

=VLOOKUP(M1,G2:H8,2)

Fixed

=VLOOKUP(M1,G2:H8,2,FALSE)

Causes, most likely first

  1. 1Approximate match on unsorted data

    Microsoft's VLOOKUP page: if the last argument is TRUE or left out, the first column needs to be sorted, otherwise the return value might be something you don't expect. In the sheet above, SL-401 is in the list as Potting mix, yet VLOOKUP returns “Ceramic pot”, because the SKU column isn't sorted (SL-401 comes after TL-301). With FALSE it returns Potting mix, and for a SKU that isn't there it returns #N/A, which is the truth. Use TRUE only on purpose, for brackets on a sorted table.

    Wrong

    =VLOOKUP(M1,G2:H8,2)

    Fixed

    =VLOOKUP(M1,G2:H8,2,FALSE)
  2. 2The column number is counted from the wrong place

    The third argument counts columns inside the table you gave VLOOKUP, starting at 1 for its first column. For a table starting in G, column 2 is H, not B. Insert a column into the table and the number now points one column too far left. Let MATCH find the column by its header: MATCH("Price", $G$1:$J$1, 0).

    Wrong

    =VLOOKUP(B2,$G$2:$J$8,2,FALSE)

    Fixed

    =VLOOKUP(B2,$G$2:$J$8,MATCH("Price",$G$1:$J$1,0),FALSE)
  3. 3The table slid when the formula was copied

    Without $, each copy of the formula searches a table one row lower. Some rows then find the right key in a shifted table and return values from the wrong row, or miss it entirely. Lock the table: $G$2:$J$8 (absolute references).

    Wrong

    =VLOOKUP(B2,G2:J8,3,FALSE)

    Fixed

    =VLOOKUP(B2,$G$2:$J$8,3,FALSE)
  4. 4Duplicate keys in the first column

    VLOOKUP returns the first match it finds. If a key appears twice, every lookup gets the first row's value, which may be the older or the wrong record. Find duplicates with COUNTIF (find duplicates), or use XLOOKUP with search mode -1 to take the last match instead.

Stop it happening again

End every exact lookup with FALSE, even when it seems to work without it: data that happens to be sorted today won't be after the next import. Keep lookup tables free of duplicate keys, or decide on purpose which match you want. Let MATCH find the return column by its header so inserting a column can't shift the result. And spot-check a lookup against one row you can verify by eye; a wrong value with no error only shows up when someone compares. Where everyone has Excel 2021 or later, Microsoft 365 or Google Sheets, XLOOKUP avoids the first two mistakes by design.

Questions

Why does VLOOKUP return a value from the row above?

With approximate match, VLOOKUP returns the last row whose key is smaller than or equal to the lookup value in what it assumes is sorted order. On unsorted data that is often a neighbour. Add FALSE and check the result again.

When is TRUE the right choice?

When the table lists boundaries in ascending order and you want the band a value falls in: grades from scores, a commission rate from a sales figure, a tax band from income. The lookups with multiple criteria and tiers guide has a live example.

In Google Sheets

Google Sheets' VLOOKUP has the same default: its help says is_sorted is TRUE (approximate match) if you leave it out, and that with TRUE the first column must be sorted ascending, otherwise you most likely get a wrong return value. The fixes are identical.

Why this happens

Approximate match exists for brackets: tax bands, grade boundaries, commission tiers, where you want the largest boundary at or below a value in a sorted table. On an unsorted list of codes it quietly returns neighbours. That's why a missing FALSE is the most expensive VLOOKUP mistake: it doesn't look like an error. XLOOKUP defaults to an exact match, which is one reason to prefer it where it's available; see VLOOKUP vs XLOOKUP and, for deliberate brackets, lookups with multiple criteria and tiers.

Practise this in 5 minutes

VLOOKUP is taught in Lesson 15: VLOOKUP (Unit 4, Lookups), on a live sheet with instant feedback. Pro

Open “VLOOKUP”

Get the formulastreak newsletter

Bite-sized formula tips you can use at work the next day, plus a heads-up when new free tools and lessons land. It arrives now and then, never in a flood.

No spam, unsubscribe in one click. We store your email, this consent and when you gave it. Details in our privacy policy.

Need a quick reference? The formula cheat sheet is free to read and print.