Contact

HSTACK Function in LibreOffice Calc

Array LibreOffice Calc LibreOffice 25.8

Join LibreOffice Calc arrays side by side with HSTACK, including unequal-height #N/A padding, output dimensions and positional alignment checks.

Verification status: Eight ordinary INDEX-selected components, dimension or padding-check expressions were recalculated in LibreOfficeDev 26.8.0.0.alpha0 (2c87e51eeaa2b413ff4ae097b2705eea1995d8e5) using headless XLSX import and forced recalculation. Exact identities, typed results and controls were checked. LibreOffice 26.8.1.1 was source-reviewed only; stable 25.8 and GUI array entry were not executed. How formula examples are checked

Quick answer: =INDEX(HSTACK(H2:J3;L2:M4);1;4) returned 10 in the tested development build.

Availability and version history

  • Introduced: LibreOffice 25.8, explicitly stated in function-specific Help.
  • Supported in: 26.8 Help and 26.8.1.1 registration; no retirement is established.
  • Scope: Desktop Calc, English semicolon-separated formulas. Help identifies the COM.MICROSOFT.HSTACK namespace outside OpenFormula 1.3.
  • Checked: October 14, 2026. Eight listed component/dimension examples were recalculated in LibreOfficeDev 26.8.0.0.alpha0 using headless XLSX import. Stable 25.8, 26.8.1.1 and GUI array entry were not executed.

What HSTACK returns

HSTACK appends arrays horizontally in argument order. The first array stays on the left, the next begins immediately to its right, and unequal heights are padded with #N/A below the shorter arrays. It combines positions, not records matched by an identifier. Function Help.

Syntax and arguments

HSTACK(Array [; Array_1 [; Array_2 [; …]]])

Square brackets mark optional arguments; do not type them. Supply one or more ranges or arrays. Later arrays are optional, but an explicit missing argument is rejected by the inspected callback; do not use an empty argument as a spacer. Use an actual padded array when a spacer is required. The output height is the maximum input height and its width is the sum of input widths.

For a whole-array result, the official Help instructs array-formula entry with Ctrl+Shift+Enter. The examples below instead select components with INDEX or inspect dimensions and padding. They do not establish a GUI spill or array-entry workflow.

Worksheet setup

Enter this source table in H2:J3:

Row H I J
2 1 2 3
3 4 5 6

Enter a second table in L2:M4:

Row L M
2 10 20
3 30 40
4 50 60

Eight reproducible examples

The native column is from LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5, using headless XLSX import and forced recalculation. TRUE is a Boolean result from the padding check, not an error value. Text is shown in quotes.

Formula Independent reference LibreOfficeDev result
=INDEX(HSTACK(H2:J3;L2:M4);1;4) 10 10
=INDEX(HSTACK(H2:J3;L2:M4);3;5) 60 60
=ISNA(INDEX(HSTACK(H2:J3;L2:M4);3;1)) TRUE TRUE
=ROWS(HSTACK(H2:J3;L2:M4)) 3 3
=COLUMNS(HSTACK(H2:J3;L2:M4)) 5 5
=INDEX(HSTACK(L2:M4;H2:J3);2;3) 4 4
=INDEX(HSTACK(H2:J3);2;2) 5 5
=INDEX(HSTACK(H2:I3;J2:J3;L2:M4);2;3) 6 6

Practical worksheet

H2:J3 contains a two-by-three table; L2:M4 contains a three-by-two table. =HSTACK(H2:J3;L2:M4) produces three rows and five columns. Its first row is 1, 2, 3, 10, 20. Its final row contains three #N/A padding positions followed by 50, 60. The listed INDEX checks confirm both a normal appended value and the different-height edge. This arrangement is useful for side-by-side reports when the row alignment has already been established.

Advanced interpretation and checks

For inputs of dimensions m₁×n₁ and m₂×n₂, the result has max(m₁,m₂) rows and n₁+n₂ columns. Here that is 3×5. Reversing the arguments changes column placement but not those dimensions. The formula with H2:I3, J2:J3 and L2:M4 demonstrates three inputs; the first two reconstruct the original left-hand three columns before the final block is appended. HSTACK with one array retains that array’s dimensions. Inspected implementation.

Boundaries and troubleshooting

Do not treat HSTACK as a database join. Different row order can silently place unrelated values beside each other even when dimensions match. #N/A introduced by shape padding is also distinct from errors already present inside source arrays. Replacing every error with zero can conceal both kinds. The ordinary tests cover unequal dimensions and selected padded positions; formula-error inputs, huge arrays and GUI array-entry behavior remain outside the executed scope.

Official evidence and checking scope

All eight saved formula identities and their typed results were reconciled. The stale SUM cache changed to 3 and the uncached SUM returned 7. Imported _xlfn.HSTACK formulas were saved with the documented COM.MICROSOFT.HSTACK identity. These checks establish the listed development-build components only; current-source guards and unexecuted cases remain source-derived.