Google Sheets
HSTACK function in Google Sheets
Appends ranges horizontally and in sequence to return a larger array.
=HSTACK(range1; [range2, …])HSTACK syntax and parameters
Two arguments, one required.
- range1rangeRequired
The first range to append.
- range2rangeRepeating
[ OPTIONAL ] Additional ranges to add to range1.
HSTACK examples
Formulas you'll actually reuse.
Customer and Amount side by side, skipping the column between them:
=HSTACK(A2:A50, C2:C50)Add a running row number as the first column:
=HSTACK(SEQUENCE(ROWS(A2:B50)), A2:B50)
HSTACK in Excel
Same name — your formula ports as-is.
Try HSTACK in the playground
Edit the example — nothing to install.
Preloaded with the HSTACK formula from Example 1 — change anything and watch it respond.
Loading the editor…
HSTACK errors
What they mean — and the fixes.
#N/AThe arrays have different heights — HSTACK pads the shorter one with #N/A; wrap the result in IFERROR(…, "") to blank them.
Related functions
More ways Google Sheets gets this done.
- CHOOSECOLSCreates a new array from the selected columns in the existing range.ArrayExcel
- CHOOSEROWSCreates a new array from the selected rows in the existing range.ArrayExcel
- LINESTGiven partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.ArrayExcel
- MDETERMReturns the matrix determinant of a square matrix specified as an array or range.ArrayExcel
- MINVERSEReturns the multiplicative inverse of a square matrix specified as an array or range.ArrayExcel
- MMULTCalculates the matrix product of two matrices specified as arrays or ranges.ArrayExcel