Excel functions / Dynamic arrays

HSTACK function

Places arrays side by side into one wider array.

Syntax

=HSTACK(array1, [array2], …)

Arguments

When to use it

HSTACK joins ranges side by side into one array, which spills. VSTACK stacks them one under another. Use it to build a report from columns that are not next to each other, or from the results of other formulas.

Examples

  1. Two columns that are apart

    ABCDEF
    1RegionRepSalesSalesRegion
    2NorthAna12001200North
    3SouthBen800800South
    4NorthChloe900
    5WestAna400
    6NorthAna300

    In E1: =HSTACK(C1:C3, A1:A3) → Sales, Region; 1200, North; 800, South

    Try this example

  2. A list with a calculated column

    ABCDEF
    1RegionRepSalesAna1320
    2NorthAna1200Ben880
    3SouthBen800
    4NorthChloe900
    5WestAna400
    6NorthAna300

    In E1: =HSTACK(B2:B3, C2:C3*1.1) → Ana, 1320; Ben, 880

    Try this example

Common mistakes

HSTACK in other languages

Excel shows function names in its own language. In these languages it also puts a semicolon between arguments where English has a comma.

Translate a whole formula

Try HSTACK in the playground

Practise it

Related functions