Function · Shape arrays
Excel VSTACK function
The Excel VSTACK function stacks arrays on top of each other. Austin and Dallas, then Houston and San Antonio, spill as four rows.
Syntax =VSTACK(array1, [array2], ...)
=VSTACK(A1:A2,B1:B2)Arguments
| Name | Required | What to pass |
|---|---|---|
| array1 | Required | The first array. It becomes the top of the result. |
| array2 | Optional | More arrays, placed underneath. Wider arrays cause #N/A padding in the narrower ones. |
Examples
Two city lists in one column
=VSTACK(A1:A2,B1:B2)Result Austin, Dallas, Houston, San Antonio
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Austin | Houston | Austin | |
| 2 | Dallas | San Antonio | Dallas | |
| 3 | Houston | |||
| 4 | San Antonio |
VSTACK appends arrays vertically. Austin and Dallas, followed by Houston and San Antonio, spill as four rows in that order. Nothing is sorted and duplicates are kept. UNIQUE of the spill is the extra step when the two lists overlap.
Different widths are padded with #N/A, the same rule HSTACK uses for different heights. EXPAND can widen the short row with 0 or a blank before you stack. A header in both arrays shows up twice, once from each list. Drop the header from the second array before you stack, or DROP it afterward. Excel 2021 does not have VSTACK.