Look across a row with HLOOKUP

Lookups · About 5 minutes

Look across a row with HLOOKUP

Some tables run sideways: one item per column, like a rate card or a plan comparison. HLOOKUP is VLOOKUP turned on its side. It searches the top row and brings back a value from a row below.

=HLOOKUP(B6,B1:D4,2,FALSE) reads as "find B6 in the top row of B1:D4, and bring back row 2 of that column, exact match only". As with VLOOKUP, leave out FALSE and it may guess.

XLOOKUP does the same with two ranges and no counting: =XLOOKUP(B6,B1:D1,B4:D4). It matches exactly by default and keeps working when a row is inserted. Use it in Excel 2021, Microsoft 365 and Google Sheets.

Part of Plus

Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.

What HLOOKUP does

HLOOKUP is the sideways version of VLOOKUP. It searches across the top row of a table and brings back a value from a row below, in the same column.

Use it when a table runs across the page: one item per column, like a size chart, a rate card or a plan comparison. You give it the row number to bring back, counted from the top of the table.

How to write HLOOKUP

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

lookup_value
What to find in the top row, like a size.
table_array
The table, with the values to search along its top row.
row_index_num
Which row of the table to bring back: 1 is the top row itself, 2 the row below, and so on.
range_lookup
FALSE for an exact match. It's optional, and leaving it out means TRUE, an approximate match that needs the top row sorted.

HLOOKUP worked example

A shirt size chart lists sizes across the top and measurements down the side. In B8, find the length for the size in B7.

A shirt size chart lists sizes across the top and measurements down the side. In B8, find the length for the size in B7.
ABCD
1SizeSML
2Chest cm92100108
3Waist cm788694
4Length cm687174
5Sleeve cm606264
6
7SizeM
8Length71
B8=HLOOKUP(B7,B1:D5,4,FALSE)Find M in the top row of B1:D5 and bring back row 4 of that column, exact match only. It shows 71.

Common HLOOKUP mistakes

The value comes from the wrong row

Count the row number from the top row of the table, not from row 1 of the sheet. In B1:D5 the length row is 4; in a table starting at row 3 it would still be 4.

A nearby column's value instead of #N/A

Add FALSE as the last part. Without it, HLOOKUP uses approximate match and can bring back a value for a label that isn't there.

An error for a row that should exist

Make the table tall enough to include the row you ask for. Asking for row 6 of a five-row table has nothing to bring back.

HLOOKUP, VLOOKUP or XLOOKUP?

Use VLOOKUP when the labels run down a column and HLOOKUP when they run across a row. Both work in every version of Excel and in Google Sheets.

XLOOKUP handles both directions: give it the top row to search and the row to bring back, like =XLOOKUP(B7,B1:D1,B4:D4), with no row number to count. It's exact by default and keeps working when rows are inserted, in Microsoft 365, Excel 2021 and later, and Google Sheets.

Questions people ask

What is the difference between VLOOKUP and HLOOKUP?

VLOOKUP searches down the first column. HLOOKUP searches across the top row and brings back a value from a row below.

How do I use HLOOKUP?

=HLOOKUP(B6,B1:D4,2,FALSE) finds B6 in the top row of B1:D4 and brings back row 2 of that column, exact match.

Why does HLOOKUP give the wrong value?

FALSE is missing, so it guesses the nearest match. End with FALSE for an exact match.

Should I use XLOOKUP instead?

Where you have it (Excel 2021, Microsoft 365, Google Sheets), yes: =XLOOKUP(B6,B1:D1,B4:D4) needs no row count.

Theme