Skip to the workspace
Pebellslearn by building
Analysis and Reporting with Excel  ›  Lesson

VLOOKUP and HLOOKUP

VLOOKUP / HLOOKUP 15 minVLOOKUP finds a key in the first column of a table and returns a value from a chosen column in the same row; HLOOKUP does the same across rows.

data analyst / VLOOKUP and HLOOKUP

Explore each scene at your own pace.

01 · The rule

The rule

VLOOKUP and HLOOKUP

The orders sheet stores item codes like C01, but Nisha's report must say "Cold coffee". The names and prices live on a separate Menu sheet. Copying them across by hand would break the moment a price changes. A lookup formula fetches the right value for each row, and updates itself when the menu does.

The Menu sheet:

A B C
1 code item price
2 C01 Cold coffee 120
3 C02 Masala chai 40
4 B01 Banana bread 90
5 B02 Croissant 110

The rule

Find the key in the first column, return column N of that row.

=VLOOKUP(D2, Menu!$A$2:$C$5, 2, FALSE)
  • D2: the key to look for, here the order's item code.
  • Menu!$A$2:$C$5: the table. VLOOKUP only ever searches its first column. The dollar signs lock the range so it does not slide as you copy down.
  • 2: which column of the table to return, counting the first column as 1. Column 2 is item; column 3 would be price.
  • FALSE: exact match only. Always use it for codes, IDs and names.

If the key is not in the first column, the result is #N/A. Treat that as a data-quality flag: a typo, a stray space, or a new item missing from the menu.

HLOOKUP is the same idea turned on its side. It searches the top row of a table and returns row N, counting down from the top. Use it when your keys run across a row, such as months in a header: =HLOOKUP("Mar", A1:M3, 3, FALSE) finds "Mar" in row 1 and returns the value from the table's third row.

Newer versions of Excel also have XLOOKUP, which can search any column and return from any other. VLOOKUP is still everywhere in existing workbooks, so you must be able to read it.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.