1. Home
  2. Functions
  3. Array
  4. HSTACK

HSTACK function

Places arrays side by side; shorter columns are padded with #N/A.

Syntax

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

Arguments

ArgumentRequiredDescription
array1RequiredA range or array
array2OptionalMore ranges or arrays

How to use HSTACK

When HSTACK returns more than one value, the result spills into the cells below and to the right. Keep those cells empty, or you get #SPILL!.

HSTACK takes 1 required argument and 1 optional argument, and accepts more values in the same pattern. Type =HSTACK( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=HSTACK({1;2}, {3;4})Result 2 by 2 array
Spilled result
AB
113
224
=HSTACK({1;2}, 3)Result 2 by 2 array
Spilled result
AB
113
22#N/A

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.