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
| VLOOKUP | HLOOKUP | |
|---|---|---|
| Searches | First column of the range | First row of the range |
| Returns from | A column N to the right | A row N below |
| Typical data shape | Records as rows (normal tables) | Time periods or attributes as columns |
| Same pitfalls | Approximate-match default, positional index | Identical — pass FALSE, count rows carefully |
| Modern replacement | XLOOKUP (any direction) | XLOOKUP works sideways too — one function replaces both |
| Compatibility | Universal | Universal (documented across all versions; executed in every LibreOffice version we test) |
Which should you use?
- VLOOKUP — Normal record-per-row tables — the 95% case.
- HLOOKUP — Header-per-column layouts like months across the top (budget sheets, quarter columns) that you can't restructure. If you can, TRANSPOSE the data or use XLOOKUP instead.
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.