← All comparisons

VLOOKUP vs HLOOKUP: vertical or horizontal?

They're the same function rotated 90°: VLOOKUP searches the first COLUMN and reads across; HLOOKUP searches the first ROW and reads down. VLOOKUP dominates because data almost always grows downward — but when you meet a horizontal table, HLOOKUP (or better, XLOOKUP) is the answer.

The differences at a glance

VLOOKUPHLOOKUP
SearchesFirst column of the rangeFirst row of the range
Returns fromA column N to the rightA row N below
Typical data shapeRecords as rows (normal tables)Time periods or attributes as columns
Same pitfallsApproximate-match default, positional indexIdentical — pass FALSE, count rows carefully
Modern replacementXLOOKUP (any direction)XLOOKUP works sideways too — one function replaces both
CompatibilityUniversalUniversal (documented across all versions; executed in every LibreOffice version we test)

Which should you use?

Compatibility (Excel for the web, Sheets & LibreOffice executed; desktop Excel per docs)

Both are part of the ancient core and run everywhere, but they are not identical across engines on the error path: an out-of-range col_index_num/row_index_num returns #REF! per Excel's docs and in our executed Google Sheets run, and #VALUE! in every LibreOffice build we test. Ordinary lookups agree. Desktop Excel behavior is per Microsoft's docs — we do not run desktop Excel. Excel for the web is a separate application with its own calculation engine, and that one we do execute: all 9 corpus cases for these functions matched the documented values there (recalculated on OneDrive, 2026-09-01); the per-case values are on the individual function pages.

Example formulas

VLOOKUP (data in rows)=VLOOKUP("cherry",A2:B10,2,FALSE)
HLOOKUP (months across the top)=HLOOKUP("Mar",B1:M5,3,FALSE)
XLOOKUP (replaces both)=XLOOKUP("Mar",B1:M1,B3:M3)

Full per-version details on each function page: VLOOKUP · HLOOKUP.

How-to recipes using these functions