Back to articles
Worksheets
2025-03-128 min read

Combine Tables from Multiple Excel Sheets with VSTACK

Functions in this article

Jump to the reference pages for the Excel functions used below.

Browse library
Table of Contents

To combine tables from several sheets in one Excel workbook, use VSTACK to place their records one below another. With named Excel Tables, the result can also grow when you add records to the sources. You don't need to copy each month's rows into a master sheet again.

The important condition is that every source has its columns in the same order. VSTACK lines up column positions; it doesn't match the headings for you. We'll combine three monthly sales tables, keep one header row, then sort the records by date.

This example uses Excel for Microsoft 365 or Excel 2024, on Windows or Mac, as listed in Microsoft's VSTACK documentation. It combines tables already in the same workbook. Importing separate files or building a report from closed workbooks needs a different setup.

Prepare the three source tables

You can download the example workbook to follow along. It contains the six original records, both output formulas, and instructions for adding the seventh record. The screenshots below show the result after that addition.

Create worksheets named Jan, Feb, and Mar. On each sheet, use A4:C4 for the headings Date, Order, and Amount, in that order. Enter the two corresponding records in rows 5 and 6:

SheetDateOrderAmount
Jan2025-01-24J02118
Jan2025-01-05J0050
Feb2025-02-10F01025
Feb2025-02-10F01025
Mar2025-03-20M02042
Mar2025-03-06M0067

The Sheet column above tells you where to put each record; it isn't part of the source tables. The duplicate February record and January's zero are deliberate. They help us see whether combining the tables changes the data.

On each worksheet, select A4:C6, choose Insert > Table, and confirm that the table has headers. Name the tables JanSales, FebSales, and MarSales, respectively, using the Table Name box on the contextual table tab. A worksheet name and a table name are separate things.

If those names in formulas are unfamiliar, see formulas and structured references in Excel Tables. We'll use the table names so the references can expand with the data, as described in Microsoft's structured-reference guide.

Enter the dates as dates that Excel recognizes, then apply the custom format yyyy-mm-dd. To check a questionable date, temporarily format its source cell as General. A real Excel date displays a serial number; text still displays the characters you entered. Restore the date format after checking.

Stack the tables with one header row

Create a Combined worksheet and leave space below and to the right of A4. The output must sit in ordinary worksheet cells, outside an Excel Table.

Check that all three source tables still have Date, Order, Amount in that order. Then enter this formula in Combined!A4:

=VSTACK(JanSales[#Headers],JanSales,FebSales,MarSales)
Formula

Press Enter once. The result spills into A4:C10: one header row followed by six records. A spill is the group of cells filled by a single formula; you don't copy the formula down.

Read the arguments from left to right:

  • JanSales[#Headers] supplies the three column headings once.
  • JanSales supplies January's data rows, without its header or totals row.
  • FebSales supplies February's data rows underneath January.
  • MarSales supplies March's data rows at the bottom.

The records retain their source order. J021 comes before J005, even though J005 has the earlier date. Both F010 rows remain, and J005's Amount remains zero. Appending records doesn't remove duplicates or sort them.

Format the destination date cells in column A as yyyy-mm-dd, and apply the number format you want to column C. The formula returns values; it doesn't copy the source cells' formatting.

Edit a record on its original monthly sheet. The corresponding value in Combined updates when Excel recalculates. To change the stacking formula itself, select A4, the top-left cell of the spill.

Include a new record automatically

On Mar, add this record to A7:C7, directly below the existing table:

DateOrderAmount
2025-03-27M02712

Make sure the new row is actually included in MarSales. If Excel hasn't extended the table, resize it to include row 7.

The Combined result should now occupy A4:C11, with M027 in B11. You haven't changed the VSTACK formula: its MarSales reference now includes an extra row. Allow space for the result to grow, and extend the destination date formatting if necessary.

Combined worksheet with A4 selected, the VSTACK formula in the formula bar, both F010 rows, and M027 dated 2025-03-27 in row 11
The spill expands to row 11 after M027 is added to MarSales. One header row and both F010 records remain.

This covers new rows in the existing tables. Creating an April sheet and table won't add them to a formula that names only January, February, and March. You must add the new table as another argument.

Sort the combined records by date

Create a Sorted worksheet. Enter Date, Order, and Amount as fixed headings in A4:C4, then enter this formula in A5:

=SORT(VSTACK(JanSales,FebSales,MarSales),1,1)
Formula

The inner VSTACK combines only the data rows. The SORT function then arranges those rows using column 1, Date, in order 1, ascending. The headings stay outside the formula so they aren't sorted with the records. Microsoft's SORT reference explains the remaining arguments.

With the original six records, the result occupies A5:C10. The Order column should read:

J005
J021
F010
F010
M006
M020
Example

After you add M027 to MarSales, it appears at the bottom, on row 11, because 27 March is the latest date. Format Sorted's date cells as yyyy-mm-dd too. Sorting the result leaves the monthly source rows in their original order.

Sorted worksheet with A5 selected, the SORT and VSTACK formula visible, and seven records ordered by date from 2025-01-05 through 2025-03-27
SORT puts J005 first and M027 last. The two F010 records stay together, with the headings above the spill.

If a date lands somewhere unexpected, check its value type in the source. In a separate check, storing Jan!A5 as the text 2025-01-24 sent J021 below all the numeric dates, after March's records. Applying a Date format to text doesn't convert it into a numeric Excel date. Correct the source value before relying on the sorted report.

Check column order before trusting the result

Suppose February's fields are Date, Amount, Order while the other tables use Date, Order, Amount. All three tables still have three columns, so their widths match. In this arrangement, February's 25 appears under Order, and F010 appears under Amount in Combined.

There may be no error message to draw your attention to this. Check the field sequence in every source and standardize it before stacking. Matching column counts alone isn't enough.

If your sources have the same headers in different positions, see how to select and reorder columns by header name.

If one argument has fewer columns, VSTACK uses the width of the widest argument and pads the missing positions with #N/A. For example, a two-column source stacked below these three-column tables would have #N/A in its missing third-column cells. Fix the source layout before treating those errors as missing sales amounts.

Distinguish blanks, zeros, and source errors

An empty source cell can look like a real zero after stacking. Clearing Jan!C5, J021's amount, produces 0 in Combined!C5. Meanwhile, J005's original zero remains 0 in Combined!C6. The combined values alone no longer tell you which source amount was blank. Check the monthly table before interpreting an unexpected zero as a recorded amount.

Source errors also carry through. When Jan!C5 contains a calculation returning #DIV/0!, that error appears in Combined!C5 and follows J021 into Sorted!C6. Fix the calculation on Jan rather than hiding the error in the report. It has a different cause from the #N/A padding created by a source with too few columns.

Fix a blocked spill

If A4 on Combined or A5 on Sorted shows #SPILL!, inspect the area where the result should appear. Move any existing values or formulas out of that area, check for merged cells, and make sure the formula isn't inside an Excel Table.

The source data belongs in Tables, but the combined result needs an unobstructed worksheet range. Microsoft's guide to spilled arrays explains this distinction. Leave room for the next month's records as well as the rows you have today.

Enjoyed this guide?

Join our newsletter to get the latest Excel tips delivered to your inbox.

You can unsubscribe anytime. See our Privacy Policy.