(Office Insider Beta only)
Windows: 2203 (Build 15104)
Mac: 16.60 (220304)

HSTACK returns the array formed by appending each of the array arguments in a column-wise fashion.  

Syntax

=HSTACK(array1,[array2],...)

The HSTACK function syntax has the following argument:

array    The arrays to append.

Remarks

HSTACK returns the array formed by appending each of the array arguments in a column-wise fashion. The resulting array will be the following dimensions:

  • Columns    The maximum of the column count from each of the array arguments.

  • Rows    the combined count of all the rows from each of the array arguments.

Errors

Excel returns a #N/A error if an array has fewer rows or columns than the maximum in any selected array. To remove the errors, use the IFERROR function.

Examples

Copy the example data in the following table and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.

Data

1

2

A

B

X

Y

3

4

C

D

5

6

Formulas

=HSTACK(A2:B4,C2:D3,E2:F2)

Data

1

2

A

B

C

#VALUE!

3

4

D

E

F

5

6

Formulas

=HSTACK(A2:B4,C2:D3,E2:F3)

See Also

Guidelines and examples of array formulas

VSTACK function

CHOOSEROWS function

CHOOSECOLS function

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Office Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×