Going Stellar

Home/Google Sheets reference

Google Sheets function · Lookup

HLOOKUP in Google Sheets: syntax and examples

HLOOKUP is VLOOKUP turned sideways. It finds a key in the first row of a range and returns the value from another row of the same column. It fits tables where months or years run across the top.

Syntax

HLOOKUP(search_key, range, index, [is_sorted])

Arguments

ArgumentTypeRequiredWhat it does
search_keyanyyesThe value to find in the first row of range.
rangerangeyesThe table to search. The key row must be its top row.
indexnumberyesWhich row of range to return, counted from 1 at the key row.
is_sortedbooleannoFALSE for an exact match. TRUE or omitted means approximate match on a sorted first row.

Examples

The examples use this table, starting in A1:

MonthJanFebMar
Sales12095140
Orders12915
Returns102
=HLOOKUP("Feb", A1:D4, 2, FALSE)

Result: 95

Sales for February: the key is in the top row, row 2 holds the sales.

Run in a Google Sheet (English US locale) on .

=HLOOKUP("Mar", A1:D4, 3, FALSE)

Result: 15

Orders for March, from the third row of the table.

Run in a Google Sheet (English US locale) on .

=IFERROR(HLOOKUP("Apr", A1:D4, 2, FALSE), "no data")

Result: no data

A month that is not in the table. IFERROR replaces #N/A with your text.

Run in a Google Sheet (English US locale) on .

=ARRAYFORMULA(HLOOKUP({"Jan", "Mar"}, A1:D4, 4, FALSE))

Result:

12

Two keys in a row: one result per key, side by side.

Run in a Google Sheet (English US locale) on .

=HLOOKUP("feb", A1:D4, 2, FALSE)

Result: 95

The match ignores case, so "feb" finds "Feb".

Run in a Google Sheet (English US locale) on .

Common errors

  • The key must sit in the top row of range. A label in the first column, such as "Sales", returns #N/A.
  • An index larger than the number of rows in range returns #REF!, for example 5 on a four-row table.
  • Without is_sorted the match is approximate and expects a sorted top row. Write FALSE for names and codes.
  • If the labels are in a column and the values to the right, use VLOOKUP, or XLOOKUP, which works in both directions.

Compared with Excel

Same arguments as Excel HLOOKUP.

Sources

  1. HLOOKUP (Docs Editors Help)

Markdown version · All functions