HSTACK
Join two or more ranges side by side to build one wider array in a single formula.
Spreadsheet editor
Spreadsheet editor
Syntax
=HSTACK(array1, [array2], ...)
Returns: Array Arguments
| Argument | Required | Description |
|---|---|---|
| array1 | Yes | The first range or array to join. This forms the left block of the combined result. |
| array2, ... | No | Extra ranges or arrays to append to the right of array1, in the order you list them. You can keep adding more, each one sitting next to the last. |
About
Use it when related data sits in different spots and you want it side by side: a column of names next to a column of scores, two reports you want lined up for comparison, or several lists you want laid out across one row of columns. Because the output is a live array, it refreshes on its own whenever the source ranges change, so you never have to rebuild the combined table by hand. Pair it with SORT or FILTER to organize the joined result, or with CHOOSECOLS to pick out the columns you actually need.
HSTACK works in Microsoft 365, Excel for the web, and Excel 2021 and later. If your ranges have different heights, HSTACK matches the tallest one and fills the extra cells with #N/A. To stack ranges top to bottom instead of side by side, use its companion VSTACK, and to grab a set number of rows or columns from the result, use TAKE.
Examples
Watch #N/A appear from mismatched heights
Spreadsheet editor
Get the column order right
Spreadsheet editor
Join two columns, then keep the winners
Spreadsheet editor
Watch out for
#N/A from mismatched heights
When the ranges you join have different numbers of rows, HSTACK matches the tallest one and pads the gaps with #N/A.
→ Make sure every range has the same number of rows, or wrap the formula in IFERROR to swap the #N/A padding for a blank.
Spill range is blocked
HSTACK needs empty cells to the right of the formula to fill. If anything is in the way, you get a #SPILL! error instead of the joined array.
→ Clear the cells beside and below the formula so the combined result has room to spill.
Not available in older Excel
HSTACK only exists in Microsoft 365 and Excel 2021 and later, so it returns a #NAME? error in Excel 2019 and earlier.
→ On older versions, place each range next to the last by hand, or rebuild the table with helper columns.
Wrong column order
HSTACK adds ranges in the exact order you list them, so a label or key column can end up on the wrong side.
→ List the range you want on the left first, then each block to the right in the order it should appear.