Syntax
=HSTACK(array1, [array2], ...)Arguments
| Argument | Required | Description |
|---|---|---|
array1 | Required | A range or array |
array2 | Optional | More ranges or arrays |
How to use HSTACK
When HSTACK returns more than one value, the result spills into the cells below and to the right. Keep those cells empty, or you get #SPILL!.
HSTACK takes 1 required argument and 1 optional argument, and accepts more values in the same pattern. Type =HSTACK( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.
Examples
Each result below was calculated by the SheetsBat formula engine.
=HSTACK({1;2}, {3;4})Result Spilled result
| A | B | |
|---|---|---|
| 1 | 1 | 3 |
| 2 | 2 | 4 |
=HSTACK({1;2}, 3)Result Spilled result
| A | B | |
|---|---|---|
| 1 | 1 | 3 |
| 2 | 2 | #N/A |
Related array functions
- EXPANDExpands an array to the given number of rows and columns, filling new cells with a pad value.
- FILTERReturns the rows (or columns) of a range or array that meet a condition.
- FLATTENPuts the values of one or more ranges into a single column, reading row by row.
- GROUPBYGroups rows by the values of one or more columns and aggregates the values of each group.
- MAKEARRAYBuilds an array of the given size by calling a LAMBDA with each row and column number.
- MAPApplies a LAMBDA to each value of one or more arrays and returns the results.
- PERCENTOFReturns the sum of a subset of values as a fraction of the sum of all values.
- PIVOTBYSummarizes data by row and column fields and aggregates the values at each intersection.
- QUERYRuns a query (select, where, group by, order by, limit, offset, label) over a range with optional header rows.