HSTACK Function
Joins arrays side by side into one wider array.
Category
Lookup & Reference
Available in
Microsoft 365, Excel 2024
Returns
A spilled array
Overview
HSTACK places ranges next to each other, left to right. It's perfect for rearranging columns or adding a calculated column alongside existing data.
If the arrays are different heights, the shorter ones are padded with #N/A.
Syntax
=HSTACK(array1, [array2], …)
Arguments
| Argument | Required? | What it does |
|---|---|---|
| array1 | Yes | The first array or range. |
| array2, … | Optional | More arrays to append to the right. |
Examples
Example 1 — Reordering columns
Put the Sales column before the Rep column.
D1fx=HSTACK(B1:B3, A1:A3)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Rep | Sales | Sales | Rep | |
| 2 | Ana | 400 | 400 | Ana | |
| 3 | Ben | 350 | 350 | Ben |
=HSTACK(B1:B3, A1:A3) Explain
Example 2 — Adding a calculated column
Show the data with a 10% bonus column attached.
=HSTACK(A2:B10, B2:B10 * 0.1) Explain
Wrap in IFNA(…, "") to blank out any #N/A padding when the arrays differ in height.
Common mistakes
- #N/A in the result. The arrays have different heights. Pad with IFNA or EXPAND.
Notes
- Related functions: VSTACK, CHOOSECOLS, EXPAND.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.