Quick Navigation
HSTACK Function
Summary
The HSTACK function horizontally combines multiple arrays or ranges side by side into a single larger array. Perfect for merging datasets, creating summary tables, or building dynamic reports from separate data sources.
Syntax
=HSTACK(array1,[array2],...)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| array1 | Array/Range |
Yes | The first array or range to stack horizontally |
| array2,... | Array/Range |
No | Additional arrays/ranges to append side by side (optional, repeat as needed) |
Using the HSTACK Function
HSTACK is ideal for combining related datasets horizontally. Use it to merge columns from different sources, create combined summary tables, or build dynamic dashboards. The function automatically aligns rows and pads shorter arrays with #N/A values.
Common HSTACK Examples
Combine Two Simple Tables
=HSTACK(A2:C3,E2:G3)
Merges two 2x3 tables side-by-side into a single 2x6 array. Perfect for combining related datasets.
Multiple Arrays with Row Padding
=HSTACK(A2:B4,C2:D3,E2:F2)
Combines arrays of different heights. Shorter arrays get #N/A padding to match the tallest array (3 rows).
Handle #N/A with IFERROR
=IFERROR(HSTACK(A2:B4,C2:D3,E2:F2),"Missing")
Replaces #N/A padding errors with custom text for cleaner output.
Frequently Asked Questions
Common Errors and Solutions
#N/A in output
Cause: Some arrays have fewer rows than the maximum
Solution: Wrap in IFERROR: =IFERROR(HSTACK(...),"")
#VALUE!
Cause: One of the array arguments contains incompatible data
Solution: Check all ranges contain valid data types
Notes
- Available only in Excel 365 and Excel 2021+
- Maximum rows determined by tallest input array
- Maximum columns = sum of all input array columns
- Works with dynamic arrays, spilling automatically
- Pairs perfectly with VSTACK for 2D array building
Compatibility
Available in: Excel 365, Excel 2021
Not available in: Excel 2019, Excel 2016, Excel 2013, Excel 2010, Excel 2007
Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 365, Excel 2021+