The VSTACK function in Google Sheets is a powerful tool designed for combining multiple ranges of data vertically. When working with datasets that require consolidation, VSTACK simplifies the process by allowing users to append different arrays into a single cohesive format. This can be particularly beneficial for data analysis, reporting, and visualization tasks that involve extensive data manipulation.
Syntax
VSTACK(array1, [array2, ...])
- array1: The first range of data that will be included.
- array2: Additional ranges to append, optional and can be multiple.
Example #1
=VSTACK(A1:A3, B1:B3)
This function combines the values in ranges A1 through A3 and B1 through B3 vertically.
Result example: If A1:A3 contains {1, 2, 3} and B1:B3 contains {4, 5, 6}, the output will be:
{1, 2, 3, 4, 5, 6}.
Example #2
=VSTACK({"Apple", "Banana"}, {"Cherry", "Date"})
In this instance, the function concatenates the two sets of fruit names into a single column.
Result example: The output will be:
{“Apple”, “Banana”, “Cherry”, “Date”}.
Example #3
=VSTACK({10, 20}, {30; 40; 50})
Here, the function takes a single-row array of {10, 20} and a single-column array of {30; 40; 50} and combines them vertically.
Result example: The output will be:
{10, 20, 30, 40, 50}.
Error handling
- REF!: This error indicates that a referenced cell or range is not valid, often caused by missing or incorrectly specified arrays.
- VALUE!: This error appears when non-compatible data types are provided in the parameters, such as text being used instead of numbers.
- N/A: This signifies that one or more of the provided arrays has no data available to combine.