VLOOKUP

On this page 7

VLOOKUP is a spreadsheet function that searches for a value in the first column of a range and returns the value from a specified column in the same row. Among office applications, it is one of the most widely used formulas in Microsoft Excel, Google Sheets and LibreOffice Calc, where it joins data from separate tables by a shared key such as a product code, employee ID or invoice number.

The “V” stands for vertical, because the function scans down a column; its sibling HLOOKUP scans across a row. VLOOKUP remains essential knowledge for anyone who maintains spreadsheets, even though newer functions such as XLOOKUP and the INDEX and MATCH combination now overcome most of its limitations.

How the VLOOKUP function works

VLOOKUP works by taking a lookup value, locating it in the leftmost column of a table array, moving across that row by a given number of columns and returning the cell found there. The full syntax is =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]), and the same argument order applies in Google Sheets and LibreOffice Calc, where the last argument is sometimes called the sort order.

The table below explains each argument and its typical values.

ArgumentMeaningTypical value
lookup_valueThe value to findA cell reference such as A2
table_arrayThe range to search, key column firstAn absolute range such as $E$2:$H$500
col_index_numColumn number to return, counted from 1An integer such as 3
range_lookupMatch mode: approximate or exactFALSE for exact match
VLOOKUP arguments

With exact match (FALSE or 0), VLOOKUP returns the first row whose key equals the lookup value, or the #N/A error if none exists. With approximate match (TRUE or omitted), it assumes the first column is sorted in ascending order and returns the last row whose key is less than or equal to the lookup value, which is useful for brackets such as tax rates or discount tiers.

Exact match and approximate match in practice

Choosing the match mode is the single most consequential decision in a VLOOKUP formula. Because approximate match is the default when the fourth argument is omitted, many incorrect results come from formulas that silently use a mode the author never intended.

This table compares the two modes on the points that matter for correct results.

AspectExact matchApproximate match
Argument valueFALSE or 0TRUE, 1 or omitted
Sorting requiredNoYes, ascending by key column
Result when key is missing#N/A errorNearest lower key
Search methodLinear scanBinary search, much faster on large ranges
Typical useCodes, IDs, namesGrade bands, price tiers, commission levels
Exact match versus approximate match

The speed difference is real on large data sets: a binary search over 100,000 sorted rows needs about 17 comparisons, while a linear scan may need tens of thousands. Some advanced users exploit this with a double approximate lookup that checks for an exact hit, but the technique depends on perfectly sorted data and is easy to break.

VLOOKUP compared with XLOOKUP and INDEX and MATCH

VLOOKUP has well-known structural limits, and the alternatives exist mainly to remove them. Its biggest constraint is that the key column must be the leftmost column of the range, so it cannot return values to the left of the key, and its column number is a hard-coded integer that breaks when someone inserts or deletes a column.

FeatureVLOOKUPINDEX and MATCHXLOOKUP
Return column left of keyNot possiblePossiblePossible
Robust to inserted columnsNo, index is fixedYesYes
Default match modeApproximateExact with 0 in MATCHExact
Built-in not-found valueNo, needs IFERROR or IFNANo, needs IFERROR or IFNAYes, fourth argument
Search from the last rowNoOnly with workaroundsYes, search mode argument
AvailabilityAll spreadsheet programsAll spreadsheet programsExcel in Microsoft 365, Excel 2021 and later, Google Sheets, recent LibreOffice
Comparison of lookup approaches

For new work in Microsoft 365 or Google Sheets, XLOOKUP is usually the better default. VLOOKUP still makes sense when a workbook must open in older Excel versions, when colleagues already understand it, or when a simple left-to-right lookup is all that is required. For relationships across many tables, a pivot table or Power Query merge is often more maintainable than hundreds of lookup formulas.

Common VLOOKUP errors and how to fix them

Most VLOOKUP problems come from data that looks identical but is not, or from ranges that shift when formulas are copied. The #N/A error is not always a fault: with exact match it correctly signals that the key does not exist, so the first diagnostic step is to confirm whether a match should exist at all.

SymptomLikely causeFix
#N/A although the key is visibleNumber stored as text, or the reverseConvert types with VALUE or TEXT, or clean the source
#N/A for some rows onlyLeading or trailing spacesWrap keys in TRIM or clean the data
Wrong value returnedApproximate match on unsorted dataSet the fourth argument to FALSE
#REF! errorColumn index exceeds range widthCorrect col_index_num or widen the range
Results break after copying downRelative table_array referenceMake the range absolute with $ signs
Results wrong after inserting a columnHard-coded column numberUse MATCH for the index, or switch to XLOOKUP
Frequent VLOOKUP problems

Two further pitfalls deserve attention. VLOOKUP is not case-sensitive, so “abc” and “ABC” are treated as the same key, and it always returns the first match only when duplicates exist. If keys can repeat, deduplicate the lookup table first or use a filtering function that returns every match.

Good practice for reliable lookups

Reliable VLOOKUP formulas depend as much on disciplined data structure as on the formula itself. Lookup tables work best when they are stored as structured tables with one row per key, consistent data types and no merged cells.

  • Always state the fourth argument explicitly, normally FALSE, so the match mode is visible to anyone reading the formula.
  • Use structured table references or named ranges so that the lookup range grows automatically with new rows.
  • Wrap results in IFNA rather than IFERROR when only missing keys should be handled, so genuine formula errors stay visible.
  • Keep lookup tables on a dedicated sheet and protect them from accidental edits.
  • Avoid whole-column ranges in very large workbooks, because they can slow recalculation noticeably.

The idea in brief

VLOOKUP lets a spreadsheet look something up in a list for you. You give it a value, such as a product code. It finds that code in the first column of a table. Then it reads the answer from another column in the same row.

It works like finding a name in a phone book and reading the number next to it. The main thing to remember is to ask for an exact match. Otherwise the spreadsheet may quietly return a nearby entry instead.

A practical scenario

An accounts assistant at a wholesale distributor receives a monthly export of 3,200 order lines that contains product codes but no prices. The current price list, with about 850 products, sits on a separate sheet with the product code in column A and the unit price in column D.

In the order sheet, the assistant enters =IFNA(VLOOKUP(B2, Prices!$A$2:$D$851, 4, FALSE), "Check code") and copies it down all 3,200 rows. Within seconds every line shows its unit price, and 14 lines display “Check code” because they reference discontinued products.

A second formula multiplies price by quantity, and the monthly invoicing preparation that previously took most of a day by manual searching is finished in under an hour, with the discontinued items flagged for the sales team to review.