VSTACK vs Power Query vs VBA — which fits you?
| Method | Best for | Version needed |
|---|---|---|
| VSTACK() | Quick stack of identical tables | Microsoft 365 / 2024 |
| Power Query | Clean + combine messy data | 2016+ |
| VBA | Repeatable automation | All versions |
What's your merge goal?
| Your Need | Recommended Method | Key Consideration |
|---|---|---|
| 📊 Aggregate by category (SUM/AVERAGE) | Consolidate Function | ✅ Needs consistent structure, supports label matching |
| 📋 Simple stacking (365 users) | VSTACK Formula | ✅ Dynamic updates, older versions need alternatives |
| ⚙️ Batch merge sheets/workbooks | VBA Macro | ⚠️ Needs backup, for advanced users |
Choose Your Method
Power Query Append (Stack Rows into One Sheet)
Best for combining many worksheets with identical columns into one table. Available in Excel 2016+ and Microsoft 365.
Open Power Query
Go to the Data tab → Get Data → From File → From Workbook, then select your file.
Select the Sheets
In the Navigator pane, check the worksheets you want to combine, then click Transform Data to open the Power Query Editor.
Append the Queries
In the Power Query Editor, go to Home → Append Queries → Append Queries as New. Choose Three or more tables, add every sheet to the list, then click OK.
Clean Up Headers & Load
Use Home → Use First Row as Headers, then filter out the repeated header rows each sheet contributed. Finally click Close & Load to a new worksheet.
Consolidate Function (Aggregate by Category)
Best for aggregating data by category (SUM/AVERAGE) when sheets share the same structure.
Click Data > Consolidate
Go to the Data tab → Click Consolidate.
Choose the Function
Select the aggregation function: SUM, AVERAGE, COUNT, etc.
Add Source Ranges
Click Add for each sheet's data range. Check Top row and Left column if your sheets have labels.
Click OK to Generate
Click OK. The combined table appears at your selected location.
VSTACK Formula (Simple Stacking)
Best for simply stacking data rows. Available in Microsoft 365 and Excel 2024.
Select the Target Cell
Click the cell where you want the stacked data to begin.
Enter the VSTACK Formula
Type: =VSTACK(Sheet1!A1:D10, Sheet2!A1:D10)
Press Enter
Press Enter. The data from both sheets automatically stacks vertically.
=INDEX(A:A, ROW()) combined with row-offset logic — or simply use Power Query's Append function.
VBA Macro (Batch Merge for Advanced Users)
Automate merging multiple sheets or workbooks into one.
⚠️ VBA Warning
VBA operations cannot be undone! Always backup your workbook before running macros. Only suitable for users familiar with VBA.
Open VBA Editor
Press Alt + F11 (Windows) or Fn + Option + F11 (Mac).
Insert a New Module
Click Insert → Module to create a new code module.
Paste the Merge Code
Copy and paste this code to merge all sheets into a "Combined" sheet:
Dim ws As Worksheet
Dim target As Worksheet
Dim lastRow As Long, copyRow As Long
Set target = Worksheets.Add
target.Name = "Combined"
copyRow = 1
For Each ws In Worksheets
If ws.Name <> "Combined" Then
ws.UsedRange.Copy target.Rows(copyRow)
copyRow = copyRow + ws.UsedRange.Rows.Count
End If
Next ws
End Sub
Run the Macro
Press F5 to run. All sheets get merged into a new "Combined" sheet.
If ws.Name <> "Combined" line to exclude specific sheets you don't want merged.
About This Guide
Four ways to combine worksheets into one, each for a different job: Power Query (append rows, best all-round), Consolidate (aggregate by label), VSTACK (stack rows dynamically, Excel 365/2024 only), and VBA (batch merge across workbooks). The right choice depends on whether your sheets share identical headers.
Frequently Asked Questions
Merged Your Data? Keep It Organized!
Protect Merged Data
Prevent accidental edits to your combined table. Learn the correct protection method.
Learn More →Print Combined Sheets
Print your merged data correctly. Page setup, preview, and format fixes.
Learn More →Continue Exploring
Sources & References
This guide was written and fact-checked against Microsoft's official Excel documentation.
Disclaimer: This guide is for informational and educational purposes only. Always backup your files before merging data. Last Updated: August 18, 2026.