HSTACK

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

Returns the array after putting multiple arrays next to each other.

array1The first array to be appended.
array2(Optional) The second array to be appended.

REMARKS
* This function was added in Microsoft 365.
* This function can create a Dynamic Array Formula.
* This function can be used to combine data from multiple worksheets.
* If the arrays are single columns, they are placed next to each other, left to right. Example 1.
* If the arrays are single rows, they are placed next to each other in a single row. Example 2.
* If the arrays are not the same size, they are padded with #N/A.
* You can have a maximum of 254 arguments.
* You can use the VSTACK function to return the array array after putting multiple arrays on top of each other.
* You can use the TOCOL function to return the array transformed into a single column.
* You can use the TOROW function to return the array transformed into a single row.
* This function was first released in March 2022.
* For the Microsoft documentation refer to support.microsoft.com

 ABCDEF
1=HSTACK(C1:C2,D1:D2) = {1,2 ; 5,6} 1234
2=HSTACK(C1:D1,C2:D2) = {1,2,5,6} 567 
3=HSTACK(C1:C2,E1:E2) = {1,3 ; 5,7} 8910 
4=HSTACK(C1:C2,D1:D2,E1:E2) = {1,2,3 ; 5,6,7} 11   
5=HSTACK(C1:C2,D1:E2) = {1,2,3 ; 5,6,7}     
6=HSTACK(C1:C3,D1:E3) = {1,2,3 ; 5,6,7 ; 8,9,10}     
7=HSTACK(C1:F1,C2:F2) = {1,2,3,4,5,6,7,0}     
8=HSTACK(C4,E3,F1) = {11,10,4}     
9=HSTACK(C1:C2,D1) = {1,2 ; 5,#N/A}     
10=HSTACK({"a" ; "b"},D1:D2) = {"a",2 ; "b",6}     
11=HSTACK({"a","b"},D1:D2) = {"a","b",2 ; #N/A,#N/A,6}     

1 - What is the combination of the range "C1:C2" and "D1:D2" as one array.
2 - What is the combination of the range "C1:D1" and "C2:D2" as one array.
3 - What is the combination of the range "C1:C2" and "E1:E2" as one array.
4 - What is the combination of the range "C1:C2", "D1:D2" and "E1:E2" as one array.
5 - What is the combination of the range "C1:C2" and "D1:E2" as one array.
6 - What is the combination of the range "C1:F1" and "C2:F2" as one array.
7 - What is the combination of the range "C1:C2" and "D1" as one array.
8 - What is the combination of the range "C4", "E3" and "F1" as one array. These individual values are placed in a horizontal array.
9 - What is the combination of the range "C1:C2" and "D1" as one array. Notice the second array is a different size so #N/A is used as padding.
10 - What is the combination of the array {"a" ; "b"} and "D1:D2" as one array. Notice the semi-colon in the array. This is interpreted as a 2x2 (2 row, 2 column) array the same size as "D1:D2"
11 - What is the combination of the array {"a","b"} and "D1:D2" as one array. Notice the comma in the array. This is interpreted as a 1x2 (1 row, 2 column) array a different size to "D1:D2"

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top