VLOOKUP

VLOOKUP (Vertical Lookup) searches for a value in the first column of a range and returns a corresponding value from another column in the same row.

Syntax

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
  • lookup_value - the value you want to find.
  • table_array - the range that contains the data.
  • col_index_num - the column number (counting from the left of the range) to return.
  • range_lookup - FALSE for an exact match, TRUE for an approximate match.

Example

=VLOOKUP("Noida", A2:C50, 3, FALSE)
' Looks for "Noida" in column A and returns the value from column C in that row

Common Pitfall

Forgetting to set the last argument to FALSE is one of the most common VLOOKUP mistakes - Excel then performs an approximate match, which can silently return the wrong row on unsorted data.

VLOOKUP can only look to the right of the lookup column. For lookups that need to search leftward, functions like INDEX and MATCH are used instead.

A Worked Example With a Price List

Suppose a product list sits in A2:C6 and an order sheet needs each product's price.

A: CodeB: ProductC: Price
P101Keyboard799
P102Mouse349
P103Monitor8999
P104Webcam1899
P105Headset1299

If the order sheet has a product code in cell E2, this formula returns its price:

=VLOOKUP(E2, $A$2:$C$6, 3, FALSE)
  1. Excel takes the code in E2, say P104.
  2. It scans column A of the range from top to bottom until it finds an exact match.
  3. It moves across that row to the third column of the range.
  4. It returns 1899.

The dollar signs lock the table range, so the formula can be copied down the order sheet without the range sliding.

Handling Missing Values Gracefully

When a code is not in the list, VLOOKUP returns #N/A. Wrap it to show a friendly message instead:

=IFERROR(VLOOKUP(E2, $A$2:$C$6, 3, FALSE), "Not found")

Use this carefully. Hiding every error can also hide genuine problems, such as a typo in the code.

When Approximate Match Is the Right Choice

Approximate match is useful for bands, such as grades or tax slabs. The first column must be sorted in ascending order.

Score from | Grade
0          | F
40         | C
60         | B
80         | A

=VLOOKUP(73, $G$2:$H$5, 2, TRUE)    returns B

Excel finds the largest value that is less than or equal to 73, which is 60, and returns its grade.

Better Alternatives in Modern Excel

FunctionStrength
XLOOKUPLooks left or right, exact match by default, built-in "if not found" argument
INDEX + MATCHWorks in older versions, does not break when columns are inserted
VLOOKUPFamiliar and supported everywhere
=XLOOKUP(E2, A2:A6, C2:C6, "Not found")
=INDEX(C2:C6, MATCH(E2, A2:A6, 0))

In Python, the same lookup is usually a merge: orders.merge(products, on="Code", how="left").

For new workbooks, XLOOKUP is usually the better default. Keep VLOOKUP in mind for files shared with people on older Excel versions, where XLOOKUP is not available.

Why VLOOKUP Returns the Wrong Answer

  • Extra spaces: "P104 " does not equal "P104". Clean values with TRIM.
  • Numbers stored as text: 101 and "101" do not match; convert one side so both share a type.
  • Hard-coded column index: inserting a column inside the range shifts results; consider MATCH for the column number.
  • Duplicates in the key column: only the first match is returned, silently.
  • Unlocked range: without $, copied formulas look in the wrong rows.

Ready to Master Data Science?

Join Uncodemy's Data Science Course and build real, job-ready skills with expert mentors.

Explore Course