Google Sheets function · Array
VSTACK in Google Sheets: syntax and examples
VSTACK stacks ranges and arrays vertically, in the order you list them. The result spills into the cells below and to the right of the formula. It replaces a long chain of copy and paste when sources live in separate blocks.
Syntax
VSTACK(range1; [range2, …])
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
range1 | range | yes | The first range or array. It sets the top of the result. |
range2, … | range | no | More ranges or arrays, appended below in order. |
Examples
The examples use this table, starting in A1:
| Lamp | 5 | Chair | 2 |
| Desk | 3 | Shelf | 8 |
| Rug | 7 |
=VSTACK(A1:B3, C1:D2)Result:
| Lamp | 5 |
| Desk | 3 |
| Rug | 7 |
| Chair | 2 |
| Shelf | 8 |
Two blocks with two columns each become one list of five rows.
Run in a Google Sheet (English US locale) on .
=VSTACK(A1:B3, {"Total", SUM(B1:B3)})Result:
| Lamp | 5 |
| Desk | 3 |
| Rug | 7 |
| Total | 15 |
A typed array adds a total row under the range.
Run in a Google Sheet (English US locale) on .
=SUM(VSTACK(B1:B3, D1:D2))Result: 25
Stack two quantity columns and sum them as one list.
Run in a Google Sheet (English US locale) on .
=SORT(VSTACK(A1:B3, C1:D2), 2, FALSE)Result:
| Shelf | 8 |
| Rug | 7 |
| Lamp | 5 |
| Desk | 3 |
| Chair | 2 |
Combine the blocks, then sort by quantity, largest first.
Run in a Google Sheet (English US locale) on .
=ROWS(VSTACK(A1:B3, C1:D2))Result: 5
The result has 3 + 2 rows.
Run in a Google Sheet (English US locale) on .
Common errors
- Ranges with different widths are padded: the missing cells of the narrower range show #N/A.
- The result spills, so the cells under and next to the formula must be empty. A value there blocks it with a #REF! error.
- Headers repeat: if every block starts with a header row, the stacked list contains each header. Start the blocks below the headers.
- Blank cells inside a range are not skipped: the stacked list keeps every row.
Compared with Excel
Excel 365 has VSTACK too. Excel pads a narrower range with #N/A in the same way.