You have January sales in Sheet1, February in Sheet2, March in Sheet3. Every month you copy-paste them into a master sheet, adjust column widths, fix formatting, and pray you didn't miss a row. There has to be a better way.There is. VSTACK and HSTACK turn multi-range data assembly from a manual chore into a single formula. One function appends ranges vertically, the other horizontally. No copy-paste, no macros, no risk of missing data.
What Are VSTACK and HSTACK?
VSTACK and HSTACK are part of Excel's dynamic array family. They take two or more arrays and combine them into one continuous result that spills across as many cells as needed.
Function
What It Does
Syntax
VSTACK
Stacks arrays vertically (appends rows)
=VSTACK(array1, array2, ...)
HSTACK
Stacks arrays horizontally (appends columns)
=HSTACK(array1, array2, ...)
Availability: Excel 365 (desktop, Mac, and web). Not available in Excel 2021 or earlier.The key difference from manual approaches: these formulas are dynamic. Add a row to your source data, and the VSTACK result updates automatically. You do not need to refresh it, and there is nothing to forget.
VSTACK — Vertical Stacking
VSTACK appends arrays one below the other. Think of it as stacking sheets of paper — each range becomes a new set of rows underneath the previous one.Basic syntax:
=VSTACK(Jan!A2:C100, Feb!A2:C100, Mar!A2:C100)
This takes rows 2 through 100 from three sheets and produces one continuous table.Important: VSTACK does not deduplicate or manipulate headers. If each sheet has a header row, you will get repeated headers in your output. The common pattern is to include the header only from the first range:
One formula gives you the full year. Filter or chart the result directly — it updates whenever source data changes.
HSTACK — Horizontal Stacking
HSTACK appends arrays side by side. You use it when the data you need lives in separate ranges that share the same row count.Basic syntax:
=HSTACK(A2:B100, D2:E100)
This combines columns A-B with columns D-E into one four-column result, skipping column C.
Practical Example — Side-by-Side Comparison
You have actual sales in one range and budget figures in another. HSTACK puts them next to each other for easy comparison:
=HSTACK(Actuals!B2:B100, Budget!B2:B100)
Range
What It Contains
Position After HSTACK
Actuals!B2:B100
Sales achieved
Column 1
Budget!B2:B100
Sales target
Column 2
Column count mismatch: If the ranges have different numbers of rows, HSTACK fills the shorter range with #N/A. Wrap the result in IFERROR or FILTER to clean it up.
Real-World Use Cases
Here is how you will actually use these functions:
Scenario
Formula
Why It Works
Consolidate 12 monthly sheets into yearly report
=VSTACK(Jan!A2:B, Feb!A2:B, ..., Dec!A2:B)
Single formula, auto-updates when monthly data changes
This formula pulls high-value sales (over $1,000) from three months and stacks them. When new data arrives or values change, the result recalculates automatically.You can extend this pattern: LAMBDA can process each VSTACK component before assembly, letting you transform data before combining it.
Using LET here caches each filtered range so Excel only calculates it once — a performance boost when working with large datasets.
Common Errors and Troubleshooting
A few things can trip you up with VSTACK and HSTACK:#N/A — mismatched column counts (VSTACK). If one range has 4 columns and another has 5, VSTACK fills the missing columns with #N/A. Wrap the result in IFERROR or use CHOOSECOLS to standardize column counts before stacking:
#VALUE! — blank rows filtered the wrong way. Testing the full multi-column array against "" doesn't work — the comparison applies to the whole array and throws #VALUE!. Stack the data once with LET, then filter on a single column with INDEX:
INDEX(stacked,,1) returns the first column of the stacked result, and the FILTER keeps only rows where that column isn't empty.#NAME? — VSTACK not recognized. VSTACK and HSTACK are Excel 365 only. Excel 2021, 2019, and earlier return #NAME? for these functions. In shared workbooks, confirm everyone is on Microsoft 365, or fall back to Power Query for the consolidation.Large datasets: VSTACK with 100,000+ rows works but can slow down calculation. For truly massive consolidations, Power Query (Get & Transform) handles the load better and gives you more transformation options.
VSTACK/HSTACK vs Alternatives
Method
Pros
Cons
VSTACK / HSTACK
Single formula, auto-updates, no setup
Excel 365 only
Power Query
Handles any size, data transformations, merge queries
Requires setup and manual refresh
Manual copy-paste
Works in any Excel version
Error-prone, static, time-consuming
Power Query is the right choice for one-time imports, complex merges, or data exceeding 500K rows. VSTACK and HSTACK are ideal for recurring reports where you want the result to update live without refresh.
AI Prompt Callout
Now that you have seen how VSTACK and HSTACK work with real examples, here is a template you can use with ChatGPT, Gemini, or Claude to generate a formula for your specific data:
AI Prompt Template
I have monthly sheets named Jan, Feb, and Mar with identical column structure (Date, Product, Sales) in rows 2 through 100. Write a formula to combine all three into one continuous table. Each month's data should include only rows where Sales exceeds $1,000. Use VSTACK and FILTER.
Adjust the sheet names, column structure, and threshold to match your workbook. The pattern works for any scenario where you need to stack filtered data from multiple ranges.
SheetHub's Take
VSTACK and HSTACK solve one of the most common Excel frustrations: combining data from multiple ranges with a simple, dynamic formula. They are part of the modern Excel toolkit alongside FILTER, SORT, UNIQUE, and LET.Next time you reach for copy-paste to combine data, reach for VSTACK instead. Open a workbook with data spread across multiple sheets, type =VSTACK( and select your ranges. You will not go back.
Topics
Topics in this article
Explore related topics and continue reading similar content.