Combine ranges or arrays horizontally
=HSTACK(array1, [array2], ...)
| Parameter | Description |
|---|---|
array1 |
The first array or range to combine. |
array2 |
[optional] The second array or range to combine. |
HSTACK stacks ranges or arrays horizontally. In the example below, the range B3:D3 is combined with the range B6:C6. Each subsequent range/array is ap
=HSTACK(B3:D3,B6:C6)
Ranges may include multiple rows, as seen below. The formula in F3 is:
=HSTACK(B3:B5,D3:D5)
HSTACK can work interchangeably with both arrays and ranges. In the worksheet below, we combine the array constant {"Red";"Blue";"Green"} with the ran
=HSTACK({"Red";"Blue";"Green"},B2:B4)
When HSTACK is used with arrays of different sizes, the smaller array will be expanded to match the size of the larger array. In other words, the smal
=HSTACK(B5:B8,D5:D6)
By default, the cells used for padding will display the #N/A error. One option for trapping these errors is to use the IFERROR function. The formula i
=IFERROR(HSTACK(B5:B8,D5:D6),"")