HLOOKUP Function (Gnumeric)
Search horizontal tables in Gnumeric with HLOOKUP, exact and sorted-threshold modes, row offsets and the native index-return option.
Verification status: Fresh Gnumeric 1.12.57 source and bounded native engine checks; no GUI. How formula examples are checked
Exact syntax
=HLOOKUP(value,range,row[,approximate[,as_index]])
HLOOKUP searches the first row of a rectangular range and returns a value from a specified row in the matching column. Value, range and row are required. Row is a one-based offset within the range: 1 means its header/search row, not worksheet row 1. Approximate is optional and defaults to TRUE. The Gnumeric-specific fifth argument as_index defaults to FALSE.
For an exact key lookup, explicitly set approximate to FALSE or 0. The preserved product table below demonstrates why the return row is 2: the prices are one row below the lookup headers. The entire table can move elsewhere in the sheet without changing that relative offset, provided the range reference moves with it.
Approximate mode: sorted thresholds
Approximate mode expects ascending keys in the first row and selects the last key less than or equal to the requested value. For a separate table, put 0,10,20 in A5:C5 and low,medium,high in A6:C6. =HLOOKUP(15,A5:C6,2) returns “medium” using the default approximate mode. A lookup of -1 is below the first threshold and returns #N/A.
This is a threshold lookup, not a nearest-distance match and not a substitute for exact product-name matching. Unsorted approximate lookup data can produce misleading values; do not infer reliability from a plausible result. Keep the mode explicit in operational worksheets.
Advanced application: return the matched position
=HLOOKUP("Pear",J1:L2,2,0,TRUE()) returns 1, the zero-based column offset of Pear within the table. This is different from row=2, which remains a one-based return-row argument. For a missing key with as_index TRUE, the checked output is -1 instead of the ordinary #N/A. Check the sentinel before using the offset elsewhere, and add one only if passing a successful offset into a one-based indexing system. Do not assume other spreadsheet products accept this fifth argument.
Errors and boundaries
With the two-row product range, row=3 returns #REF! and row=0 returns #VALUE!. An absent exact key returns #N/A in normal return-value mode. The source converts the row argument to an integer; use explicit integer offsets rather than depending on fractional coercion. Text-pattern, duplicate-key and locale-specific comparisons are not certified by these simple equality examples. Fix the search row and reference range before wrapping errors with a fallback, or the fallback can conceal a broken lookup.
Worked example
For the horizontal lookup, enter:
| J | K | L | |
|---|---|---|---|
| Row 1 | Apple | Pear | Plum |
| Row 2 | 5 | 8 | 4 |
=HLOOKUP("Pear",J1:L2,2,0)
Expected result: 8.
Why it works: Find a value in the row under a matching table header. The specified sample table supplies the referenced cells.
Recorded native results
=HLOOKUP("Pear",J1:L2,2,0)→ 8=HLOOKUP("Missing",J1:L2,2,0)→ #N/A=HLOOKUP("Pear",J1:L2,3,0)→ #REF!=HLOOKUP("Pear",J1:L2,0,0)→ #VALUE!=HLOOKUP(15,A5:C6,2)→ medium=HLOOKUP(-1,A5:C6,2,TRUE())→ #N/A=HLOOKUP("Pear",J1:L2,2,0,TRUE())→ 1=HLOOKUP("Missing",J1:L2,2,0,TRUE())→ -1
Availability, portability and verification
Official NEWS identifies HLOOKUP as implemented in Gnumeric 0.19. The last functioning release is not established. The retained historical check documented Gnumeric 1.12.62 registration on 14 October 2026, for desktop installations with the fn-lookup module included and enabled. This is separate from the fresh official 1.12.57 source inspection and bounded ssconvert execution on 17 October 2026. No execution of 1.12.62 is claimed.
Every saved input formula and output cell was independently read back; results match explicit code-point, table-lookup, Roman-notation or sorted-multiset expectations exactly. Source and native evidence hashes were verified. This is engine evidence, not GUI verification. The earlier comparable LibreOffice Calc 25.2 test is historical context; it does not establish identical coercion or extensions across programs. Check receiving applications and locales before transferring formulas.