FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

HSTACK in Google Sheets

HSTACK with worked examples you can test in the live grid. The argument details are in the Excel guide.

In Google Sheets

The arguments and common errors are covered in the HSTACK Excel guide; check the function help in Google Sheets for its own argument list.

Worked examples in Google Sheets

How many columns result

ABC
1RegionRepAmount
2EastAna1200
3WestBen850
4EastCara430
5NorthDan970
6WestEli1500

Formula: F2: =COLUMNS(HSTACK(A2:B3,C2:C3))

Result: 3

A two-column block plus a one-column block make three columns.

Reading order of a stacked block

ABC
1RegionRepAmount
2EastAna1200
3WestBen850
4EastCara430
5NorthDan970
6WestEli1500

Formula: F2: =TEXTJOIN(", ",,HSTACK(B2:B3,C2:C3))

Result: Ana, 1200, Ben, 850

TEXTJOIN reads across each row of the 2-by-2 result: Ana and 1200, then Ben and 850.

Unequal heights

ABC
1RegionRepAmount
2EastAna1200
3WestBen850
4EastCara430
5NorthDan970
6WestEli1500

Formula: F2: =INDEX(HSTACK(B2:B4,C2:C3),3,2)

Result: #N/A

The second array has only two rows, so row 3 of its column is padded with #N/A.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in F2: =HSTACK(A2:A4,C2:C4)

Example spreadsheet for HSTACK
ABCDEFG
1RegionProductUnitsPriceResult
2EastPen1202.5East120
3WestPen802.5West80
4EastBook4512East45
5NorthBook6012
6WestLamp3025
7EastLamp1525
Result in F2: East

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.