Formualizer Docs

HSTACK

Concatenates arrays horizontally into a single spilled array.

HSTACK appends columns from each argument left-to-right.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=HSTACK(array1, [array2], ...)

Arguments

ArgumentTypeRequiredDefault
array1range or any (range)Required—
array2range or any (range)Optional—

Accepts a variable number of arguments. Minimum: 1.

Remarks

  • The output has the maximum input row count.
  • Scalar arguments are treated as 1x1 values.
  • Missing rows in shorter inputs are padded with #N/A.
  • Empty inputs are skipped; if all inputs are empty, result is an empty spill.

Examples

Join two equally sized rectangular arrays.

Formula =HSTACK({1,2;3,4},{5,6;7,8})

Expected result {1, 2, 5, 6; 3, 4, 7, 8}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Join three arrays in their argument order.

Formula =HSTACK({1,2},{3,4},{5,6})

Expected result {1, 2, 3, 4, 5, 6}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Pass the smallest array as the only argument.

Formula =HSTACK({42})

Expected result 42

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A division-by-zero error is carried into the assembled output.

Formula =HSTACK(1/0)

Expected result #DIV/0!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Join two 2-row ranges side by side

Formula =HSTACK(A1:A2,B1:B2)

Input cells
AB
1110
2220

Expected result {1, 10; 2, 20}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Append a scalar column

Formula =HSTACK(A1,"OK")

Input cells
A
1"Item"

Expected result {"Item", "OK"}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

How does HSTACK combine ranges of different heights?

The output uses the tallest input and pads shorter inputs with #N/A.

How are scalar arguments treated in HSTACK?

Each scalar is treated as a 1x1 block, with #N/A below it when other inputs are taller.

Implementation

Engine source

On this page