SheetRocks
Documentation/Formulas/HSTACK

HSTACK

Horizontally stacks arrays by appending columns

Syntax

HSTACK(array1, [array_n])

Arguments

Argument Description Required
array1 The first array to stack Required
array_n Additional arrays to stack horizontally Optional

Examples

Stack two arrays horizontally

=HSTACK(A1:B2, A3:B4)
Result ⇒ Array: [[1,2,5,6], [3,4,7,8]]
A B
1 1 2
2 3 4
3 5 6
4 7 8

Combine names and scores

=HSTACK(A1:A2, A3:A4)
Result ⇒ Array: [["Alice",85], ["Bob",92]]
A
1 Alice
2 Bob
3 85
4 92

Stack multiple columns

=HSTACK(A1:A2, A3:A4, A5:A6)
Result ⇒ Array: [["A",1,"X"], ["B",2,"Y"]]
A
1 A
2 B
3 1
4 2
5 X
6 Y

Related Functions

Other Data functions:


← Back to Formula Reference