VSTACK and HSTACK in Excel: Combine Ranges and Sheets With One Formula

Isometric spreadsheet illustration showing VSTACK in Excel stacking multiple tables into one grid

Combining regional sales tables, monthly tabs, or separate team trackers in Excel used to require tedious copy-pasting or setting up a Power Query append query. With VSTACK in Excel and its horizontal sibling HSTACK, you can append ranges or entire worksheets dynamically using a single spilling formula that updates automatically whenever source rows change.

Availability & Compatibility: Per the official VSTACK function documentation and HSTACK function documentation, both functions are available in Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel for the web, Excel 2024, and Excel 2024 for Mac (plus Google Sheets). Older perpetual builds such as Excel 2021 and Excel 2019 do not support them and will display #NAME?.

How VSTACK in Excel Works (Vertical Stacking)

VSTACK appends arrays vertically, placing each range or array directly beneath the previous one in the exact order you list them. Its syntax accepts as many arrays as you need:

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

The resulting spilled array has a row count equal to the sum of all input rows, and a column count equal to the widest input array. Suppose your Practice sheet has East Region orders in A6:C9 (Order ID, Sales Rep, Revenue) and West Region orders in A12:C15. To merge both tables into one continuous list starting in F6, enter:

=VSTACK(A6:C9, A12:C15)

Unlike manual copy-paste, if you update a revenue figure in C7 or reference structured Excel Tables that grow over time, the stacked output recalculates instantly.

How HSTACK Works (Horizontal Stacking)

While VSTACK stacks tables top-to-bottom, HSTACK appends arrays side-by-side from left to right. The syntax mirrors VSTACK:

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

Here, the output height equals the tallest input array, and the width equals the combined column count of all arguments. For example, if East Region orders live in A6:C9 and a separate column of quarterly targets sits in D6:D9 (or on another tab), you can join them horizontally without writing lookup formulas:

=HSTACK(A6:C9, D6:D9)

If your columns are out of order or scattered across sheets, pair HSTACK with XLOOKUP in Excel or wrap the stacked table inside GROUPBY in Excel to summarize the combined dataset in one step.

Stack Multiple Worksheets at Once With 3D References

One of the biggest time-savers highlighted in Microsoft’s Combine data from multiple sheets guide is pairing VSTACK with a 3D sheet range. When you have identical column layouts across tabs—say East, Central, and West—you do not have to list every sheet individually:

=VSTACK(East:West!A6:C9)

Excel automatically stacks A6:C9 from every worksheet positioned between East and West in your workbook tab order. Insert a new regional tab between them later, and it flows into the master list automatically.

VSTACK vs. HSTACK vs. Power Query

Use this quick comparison to decide when a stacking formula beats Power Query or manual consolidation:

MethodDirectionAuto-UpdatesMismatched SizesBest For
VSTACKVertical (rows)Yes (live)Pads with #N/AAppending regional or monthly tables
HSTACKHorizontal (columns)Yes (live)Pads with #N/ACombining side-by-side columns
Power Query AppendVertical (rows)Manual RefreshAligns by header nameLarge CSVs or multi-file folders

Troubleshooting #N/A, #SPILL!, and Blank Cells

  • #N/A errors in extra columns or rows: When you stack ranges of unequal width with VSTACK (or unequal height with HSTACK), Excel fills the missing cells with #N/A. Wrap the formula in IFERROR to replace #N/A with blank text or zero: =IFERROR(VSTACK(A6:C9, A12:B15), "").
  • #SPILL! error: Because both functions spill dynamically, any existing value or merged cell in the output area blocks the result. Follow our guide on how to fix the #SPILL! error in Excel to clear the spill range.
  • Unexpected zeros from empty source cells: If a source range includes blank cells (such as trailing empty rows in a 3D sheet range), Excel converts blank cells inside an array into 0. Filter out empty rows afterward with FILTER or trim your source range.
  • #NAME? error: The workbook was opened in Excel 2021 or older, where VSTACK and HSTACK are unavailable.

Frequently Asked Questions

Download the practice workbook

The same data as this tutorial, with empty answer cells and a Solutions sheet.

Team Xl in Excel

Team Xl in Excel

Spreadsheet Architect & Educator at Xl in Excel. Sharing advanced formulas, dynamic arrays, and clean data modeling techniques.

Learn More About Team Xl in Excel →

Leave a Reply

Your email address will not be published. Required fields are marked *

Zoom: 100% | UTF-8 | Xl in Excel