HSTACK
The HSTACK
function in Google Sheets is used to append ranges horizontally and in sequence to return a larger array.
Function Syntax and Parameters
Syntax: HSTACK(range1; [range2, ...])
Parameters:
range1
: The first range to append horizontally.range2, ...
: [Optional] Additional ranges to append horizontally.
Step-by-Step Tutorial
-
Using
HSTACK
with individual ranges:- Example:
=HSTACK(A1:B2, C1:C2)
- Result:
[[A1,B1,C1,A2,B2,C2]]
- Example:
-
Using
HSTACK
with a range of cells and a single range:- Example: If
A1:B2
has the values1, 2, 3, 4
, andC1:C2
has the values5, 6
, then=HSTACK(A1:B2, C1:C2)
will return[[1, 2, 5, 3, 4, 6]]
.
- Example: If
Use Cases and Scenarios
- Data Integration: Combine data from different sources in a single array.
- Data Analysis: Merge multiple datasets horizontally for analysis.
- Reporting: Create a consolidated view of multiple sheets.
Related Functions
VSTACK
: Appends ranges vertically to return a larger array.ARRAYFORMULA
: Applies a specified formula to a range of input, and returns the resulting array.