0Pricing
Excel Formulas Academy · Lesson

Searching Across Rows With HLOOKUP

Look up values along a row instead of down a column.

Searching Across Rows With HLOOKUP is a free Excel Formulas Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Meet HLOOKUP

HLOOKUP is the horizontal twin of VLOOKUP. The H stands for Horizontal: instead of searching down a column, it searches across the top row of a table, then returns a value from further down the same column.

Use HLOOKUP when your data is laid out sideways, with labels along a row instead of down a column.

=HLOOKUP(value, table, row_index_num, [range_lookup])

The Four Arguments

HLOOKUP mirrors VLOOKUP, with one key change. Its arguments are:

  • lookup_value - what you search for in the top row
  • table_array - the range of cells
  • row_index_num - which row to return from (counted from the top)
  • [range_lookup] - TRUE for approximate, FALSE for exact

Notice the third argument is now a row index, not a column index, because the data runs down.

=HLOOKUP(lookup_value, table_array, row_index_num, FALSE)

A Sideways Sample Table

Picture a quarterly table where months run across row 1 in cells A1:D3:

  • Row 1: Jan, Feb, Mar, Apr
  • Row 2 (Sales): 100, 150, 120, 200
  • Row 3 (Costs): 60, 70, 65, 90

The top row (months) is what HLOOKUP searches. The rows below hold the data we want to return.

Your First HLOOKUP

To find the Sales figure for Mar, HLOOKUP searches the top row for "Mar", then returns the value from row 2 (Sales):

Reading it aloud: look up "Mar" across the top row of A1:D3, and return the value from the 2nd row, using an exact match. The result is 120.

=HLOOKUP("Mar", A1:D3, 2, FALSE)

Counting the Row Index

The row_index_num is counted from the top of your table_array, not from row 1 of the sheet.

In our range A1:D3, the rows are numbered:

  • Row 1 = months (the search row)
  • Row 2 = Sales
  • Row 3 = Costs

So to return Costs for a month, use row index 3. Index 1 simply returns the label you searched for.

=HLOOKUP("Feb", A1:D3, 3, FALSE)

Looking Up From a Cell

As with VLOOKUP, you usually point at a cell rather than typing the label. If a month is chosen in F1, reference it directly.

Now changing F1 to a different month instantly updates the result. This makes HLOOKUP great for a small selector that reads a sideways summary table.

=HLOOKUP(F1, A1:D3, 2, FALSE)

HLOOKUP vs VLOOKUP

The two functions are the same idea, rotated 90 degrees:

  • VLOOKUP: searches down the first column, third argument is a column index
  • HLOOKUP: searches across the top row, third argument is a row index

Choose based on your layout. If your headers run down the side, use VLOOKUP. If they run across the top, use HLOOKUP.

Exact and Approximate Still Apply

The range_lookup argument behaves identically to VLOOKUP:

  • FALSE = exact match; the top row need not be sorted; missing values give #N/A
  • TRUE = approximate match; the top row must be sorted left to right ascending

For label lookups like month names, use FALSE. For a banded row of thresholds, TRUE works, but it is rare to lay tiers out horizontally.

=HLOOKUP(F1, A1:D3, 2, FALSE)

Locking the Table When Copying

If you copy an HLOOKUP across several cells, lock the table_array with dollar signs so it does not drift. Leave the lookup_value relative if it should shift with each column.

Here, copying right keeps the table fixed while the lookup label moves to the next cell. Same discipline as VLOOKUP, just in the horizontal direction.

=HLOOKUP(B5, $A$1:$D$3, 2, FALSE)

When Horizontal Data Appears

Sideways tables show up more than you might expect:

  • Financial models with years or months as columns
  • Score sheets with rounds across the top
  • Imported reports that put periods in a header row

Rather than transposing the whole table, HLOOKUP lets you query it as-is. That said, many people prefer to keep data vertical, since most functions favor that shape, then VLOOKUP or XLOOKUP fits naturally.

=HLOOKUP(2024, A1:F4, 3, FALSE)

Pairing HLOOKUP With MATCH

Just like VLOOKUP, hard-coding the row index can be fragile. If you insert a row, the index breaks. You can make it dynamic by finding the row position with MATCH.

Here MATCH locates which row the label "Costs" sits in, down the labels in column A, and feeds that number to HLOOKUP. Now the formula keeps working even if rows move around. This is a first taste of combining lookups, which you will explore more later.

=HLOOKUP(F1, A1:D3, MATCH("Costs", A1:A3, 0), FALSE)

Quick Check

Test your grasp of horizontal lookups.

Recap: Searching Across Rows

You can now query sideways tables:

  • HLOOKUP searches across the top row and returns from a row below
  • The third argument is a row_index_num, counted from the top of the range
  • FALSE and TRUE work just like VLOOKUP for exact vs approximate
  • Lock the table with $ when copying across
  • Use it when your headers run horizontally instead of vertically

Next you will learn why VLOOKUP sometimes fails and how to diagnose it.

=HLOOKUP(F1, $A$1:$D$3, 2, FALSE)

Frequently asked questions

Is the “Searching Across Rows With HLOOKUP” lesson free?

Yes — the full text of “Searching Across Rows With HLOOKUP” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.

What will I learn in “Searching Across Rows With HLOOKUP”?

Look up values along a row instead of down a column. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Excel Formulas Academy?

No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Searching Across Rows With HLOOKUP” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Excel Formulas Academy lesson?

Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. How VLOOKUP Searches a Table
  2. Exact vs Approximate Match
  3. Searching Across Rows With HLOOKUP
  4. Why VLOOKUP Sometimes Fails
← Back to Excel Formulas Academy