intermediate 3 min read

Horizontal XLOOKUP in Google Sheets: Replace HLOOKUP

Use XLOOKUP horizontally in Google Sheets: search across a row and return from another row. Everything HLOOKUP does, without the row index number.

SB

Sheets Bootcamp

July 28, 2026

Quick Answer

XLOOKUP works sideways the moment you hand it row ranges: =XLOOKUP("Q3", A1:D1, A2:D2) searches the header row for Q3 and returns the value below it. The same six arguments work identically; only the orientation changes. It replaces HLOOKUP the same way vertical XLOOKUP replaces VLOOKUP.

Some tables grow sideways instead of down: months across the top, one metric per row. Looking up “March’s revenue” in that layout is a horizontal lookup, and the classic tool was HLOOKUP, which shares every weakness of its vertical sibling. XLOOKUP handles the horizontal case with the exact same syntax you already know.

In This Guide

Row Ranges Instead of Column Ranges

Nothing in XLOOKUP’s arguments says “column.” The lookup range and result range are just ranges, and their shape steers the search:

  • A2:A10 and C2:C10 are one column wide: XLOOKUP searches downward
  • A1:D1 and A2:D2 are one row tall: XLOOKUP searches across

The one rule is that both ranges must share the same orientation and size: two rows of four cells each, or two columns of nine cells each. Mismatched shapes fail, the same as in the vertical case.

A Quarterly Table Example

ABCD
1Q1Q2Q3Q4
2100200300400

Find Q3’s value:

Formula
=XLOOKUP("Q3", A1:D1, A2:D2)

XLOOKUP searches across row 1, finds Q3 in column C, and returns 300 from the same position in row 2. We verified this in a live sheet: the row-range form returns exactly the value beneath the matched header.

Every other argument works unchanged. A missing_value guards against a quarter that does not exist, match modes allow approximate and wildcard matching across the row, and search_mode -1 searches right-to-left for the last match.

Replacing HLOOKUP

The HLOOKUP version of the same lookup:

Formula
=HLOOKUP("Q3", A1:D2, 2, FALSE)

The 2 counts rows down from the header, and the FALSE forces exact matching, the same two traps VLOOKUP carries. Insert a row inside the range and the index silently points at the wrong data; forget the FALSE and a missing quarter returns a neighbor.

The XLOOKUP translation drops both:

HLOOKUPXLOOKUP equivalent
=HLOOKUP(“Q3”, A1:D2, 2, FALSE)=XLOOKUP(“Q3”, A1:D1, A2:D2)
=HLOOKUP(B9, A1:M40, 12, FALSE)=XLOOKUP(B9, A1:M1, A12:M12)
=IFERROR(HLOOKUP(“Q5”, A1:D2, 2, FALSE), 0)=XLOOKUP(“Q5”, A1:D1, A2:D2, 0)

And one thing HLOOKUP cannot do at all: return from a row above the search row. If your labels sit on row 10 and the data on row 3, =XLOOKUP(key, A10:M10, A3:M3) just works, the horizontal version of the left lookup.

Returning a Whole Column of Results

The same spilling behavior that returns several columns vertically returns several rows horizontally. Widen the result range downward:

Formula
=XLOOKUP("Q2", A1:D1, A2:D4)

With three data rows under the headers, the formula finds the Q2 column and spills its three values downward from the formula cell: one quarter’s entire column of metrics from one formula. The cells below the formula must be empty, or the whole thing returns #REF!, exactly like the horizontal spill case.

Mixing Directions: The Two-Way Lookup

A table with labeled rows AND labeled columns (“revenue by store, by quarter”) needs a two-way lookup: find the row by one key, the column by another. Nest a horizontal XLOOKUP inside a vertical one:

Formula
=XLOOKUP("Riverside", A2:A6, XLOOKUP("Q3", B1:E1, B2:E6))

The inner XLOOKUP searches the header row for Q3 and, because its result range spans all the data rows, hands back Q3’s whole column. The outer XLOOKUP then searches the store names and returns Riverside’s row from that column. Two keys, one intersection value.

The same pattern with INDEX and two MATCHes is covered in two-way lookups; the XLOOKUP version reads more naturally once horizontal lookups are familiar.

Frequently Asked Questions

Can XLOOKUP search horizontally in Google Sheets?
Yes. Hand XLOOKUP row ranges instead of column ranges and it searches across: =XLOOKUP("Q3", A1:D1, A2:D2) searches the header row for Q3 and returns the value beneath it from row 2.
What is the difference between XLOOKUP and HLOOKUP?
HLOOKUP searches the top row of a range and returns a value from a numbered row below it, always downward. Horizontal XLOOKUP uses two independent row ranges, so it can return from rows above the search row, defaults to exact match, and has built-in error handling.
How does XLOOKUP know whether to search vertically or horizontally?
By the shape of the ranges. Column ranges like A2:A10 make it search down a column; row ranges like A1:D1 make it search across a row. The lookup and result ranges must have the same orientation and length.
Can a horizontal XLOOKUP return an entire column of values?
Yes. Make the result range span several rows: =XLOOKUP("Q2", A1:D1, A2:D4) finds the Q2 column and spills all three of its values downward from the formula cell.
Should I still use HLOOKUP in Google Sheets?
Only for compatibility with very old spreadsheets. Horizontal XLOOKUP does everything HLOOKUP does with fewer failure modes, the same argument for argument as the vertical case. New formulas should use XLOOKUP.

You've googled this formula before. Probably more than once.

Basic Training is a free course inside a real Google Sheet that grades every formula the moment you press Enter. 7 lessons, about 40 minutes, and this loop ends.

Try the Sheet That Grades You

Free. No spam, ever.

Get Free Basic Training