Excel function

HLOOKUPfunction

Finds a value in the first row of a table and returns a value from a lower row in the same column.

All versions
=HLOOKUP("P004", B1:F4, 3, FALSE)
A
B
C
D
E
F
1
2
3
4

Click a cell to change lookup_value. Drag the corner dots to change table_array. Click the numbers on the left to change row_index_num. Drag the top-left handle of table_array down to row 2. The first row becomes the product names, so the code can no longer be found. Try breaking it on purpose to see the errors.

Result

6900

lookup_value

The value to find in the first row of table_array.

table_array
B1:F4Drag the corner dots on the table

The table to search. The search always happens in the first row of this range only.

row_index_num
3table_array has 4 rows

Which row of table_array to return. The first row is 1.

range_lookup

FALSE finds only an exact match; TRUE finds the closest value less than or equal to lookup_value.

What is the HLOOKUP function?

=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])

HLOOKUP finds a value in the first row of a table and then returns a value from a lower row in the same column. The H stands for horizontal; think of it as VLOOKUP turned on its side.

Use it for tables with items laid out across, such as monthly results or grading scales. If the values you search are listed down the left column, use VLOOKUP; if they run across the top row, use HLOOKUP.

The most important rule is the same as VLOOKUP: HLOOKUP always searches only the first row of table_array.

Arguments

lookup_value
The value to find in the first row of table_array. Text is not case-sensitive.
table_array
The table to search. The row containing lookup_value must be the first row of this range, and the row you want to return must be inside it.
row_index_num
Which row of table_array to return, counting the first row of the range as 1 rather than using the sheet row number. Below 1 gives #VALUE!; more than the rows in table_array gives #REF!.
range_lookup
FALSE finds only an exact match. TRUE or omitted uses approximate match: with no exact match it takes the largest value smaller than lookup_value, and the first row must be sorted in ascending order from left to right.

HLOOKUP examples

  1. Example 1. Price by product code

    =HLOOKUP("P004", B1:F4, 3, FALSE)

    Finds P004 in row 1 and returns row 3 of table_array (Price) in the same column: 6900. This is how the sheet looks when the page opens.

  2. Example 2. Stock by product name

    =HLOOKUP("Coffee", B2:F4, 3, FALSE)

    Starting table_array at row 2 makes the product names the first row, so you can search by name. Row 3 of the range is sheet row 4 (Stock), so the result is 15.

  3. Example 3. Grades with approximate match

    =HLOOKUP(85, B1:F2, 2, TRUE)

    List the starting score of each band in the first row in ascending order. There is no 85, so it takes 80, the largest value below 85, and returns the B underneath.

Common mistakes

FAQ

How is it different from VLOOKUP?
Only the direction. VLOOKUP searches the first column from top to bottom and returns a value from a column to the right; HLOOKUP searches the first row from left to right and returns a value from a row below.
Can XLOOKUP replace it?
Yes. With a one-row lookup array and return array, XLOOKUP searches horizontally too. XLOOKUP is available only in Microsoft 365 and Excel 2021 and later.
When do #REF! and #VALUE! appear?
row_index_num below 1 gives #VALUE!, and more than the rows in table_array gives #REF!. Click the numbers on the left of the sheet above to try it.