In Excel: use =VSTACK(range1,range2) to append rows from matching-column ranges, or =HSTACK(range1,range2) to place their columns side by side. Both stack by position and spill into the surrounding grid. Function availability: VSTACK: Excel 2024+; HSTACK: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.
On this page8
Syntax
Arguments
| Argument | required / optional | Description |
|---|---|---|
array1 | required | The first range to stack. |
array2, ... | optional | Further arrays in sequence. VSTACK pads missing columns; HSTACK pads missing rows, using #N/A. |
Related functions
Function availability: VSTACK: Excel 2024+; HSTACK: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.
For VSTACK, check that each source has the same column meanings in the same order. Exclude each repeated header row.
Enter =VSTACK(Jan!A2:B3,Feb!A2:B3) in an empty summary area outside an Excel table. Check for four records and two columns.
For HSTACK, check that rows already align: it pairs the first row of one array with the first row of the next, without matching names or IDs.
Check the predicted output dimensions and any #N/A padding before wrapping the array in another function. Inspect a source error before replacing errors in the entire output.
Use Excel table data references such as =VSTACK(JanData,FebData) when source rows should expand automatically. The source tables may grow; the spill formula itself must remain outside a table.
Apply SORT or UNIQUE only when that extra operation is intended. If the task requires matching keys or grouping the two Ada records into one total, stacking alone does not complete it.
What this does
VSTACK appends rows in argument order: output height is the sum of source heights, and output width is the widest source. HSTACK appends columns: output width is the sum of source widths, and output height is the tallest source. VSTACK pads missing columns with #N/A; HSTACK pads missing rows with #N/A. Equal widths do not prove that column meanings match: a Name/Amount source stacked with an Amount/Name source mixes fields. These are positional operations rather than joins on a key or aggregations. These functions are available in Microsoft 365 and Excel 2024. They do not discover files in a folder, and linked dynamic arrays require both source and destination workbooks to remain open. Most people learn this as a sequence of clicks and forget it by next week; learning it as a pattern instead is what lets you apply it to the next, slightly different version of the problem without starting from scratch. That is the difference this page is trying to make. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “vstack function in excel”. Start on a copy or a tiny sample, keep the affected formula visible, and compare the result with the outcome you expected before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a calculation you can defend to a CFO or an auditor, but the practical win is that someone else can open the file and understand what happened without asking you.
A worked example
Jan!A2:B3 contains Ada/10 and Ben/20; Feb!A2:B3 contains Ada/30 and Cy/40. =VSTACK(Jan!A2:B3,Feb!A2:B3) on a summary sheet returns four rows and two columns: Ada/10, Ben/20, Ada/30 and Cy/40, in that order. Enter the header once above the spill area; the two Ada rows remain separate records. For horizontal padding, put 1, 2 and 3 in A2:A4 and 10 and 20 in B2:B3. =HSTACK(A2:A4,B2:B3) in D2 returns 3 rows and 2 columns: 1/10, 2/20 and 3/#N/A. The final #N/A is a missing row in the second array, not a missing key. Keep both formulas outside Excel tables and leave their output cells free. VSTACK combines matching-width worksheet ranges in one formula that recalculates when the listed source values change. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.
In Google Sheets
Function availability: VSTACK: Excel 2024+; HSTACK: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. For “vstack function in excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.
Common mistakes
- Treating every
#N/Aas a source lookup failure. Check for a shorterHSTACKarray or a narrowerVSTACKarray first. - Using
HSTACKas a key-based join when the source rows are in different orders; rows are paired by position. - Stacking equally wide sheets whose columns have different meanings or order.
- Including header rows from every sheet, which scatters headers among the data records.
- Expecting a fixed
A2:B3reference to include a newly added row 4. Expand the reference or use a source table. - Using them in Excel 2021 or earlier, where they do not exist.
Frequently asked questions
How do I combine data from several sheets?
Use explicit matching-width ranges, for example =VSTACK(Sheet1!A2:D100,Sheet2!A2:D100). Exclude repeated headers and keep the output area free. The formula stacks by column position, not by header name.
Can a VSTACK formula read closed Excel files?
Linked dynamic arrays require both workbooks open. Closing a source workbook can produce #REF! when the linked formula refreshes. Use Power Query From Folder for a refreshable collection of files instead.
Why does HSTACK or VSTACK add #N/A?
VSTACK pads missing columns when a source is narrower; HSTACK pads missing rows when a source is shorter. Check source dimensions and schema first. IFERROR can hide the padding, but it also replaces genuine source errors, so adding it is a display choice rather than a repair.
Do new rows appear automatically?
A fixed range keeps its fixed boundaries. Use structured references to source tables, for example =VSTACK(JanData,FebData), to include their data rows as they grow. The result is a spilled array in the grid, not an Excel table; place the formula outside the tables.
What is the difference from Power Query?
VSTACK returns a worksheet array that recalculates from the listed sources, and you can combine it with other worksheet functions. Power Query offers an import and transformation workflow with a refresh step, useful for files in a folder or columns that need mapping and cleaning. Neither stacking nor appending automatically proves that different source fields belong together.
Which Excel release does this formula require?
Function availability: VSTACK: Excel 2024+; HSTACK: Excel 2024+. These are Microsoft's version markers; earlier perpetual releases do not include these functions. Check the actual product and update channel before using the formula. A marker does not establish an identical Web/Mac workflow or Google Sheets support.