Skip to main content
Version: Streamsheets 3.0

STACK.ADD

This function adds the cells in a SourceRange to a StackRange.The Stack range is a range of cells on the sheet <Streamsheet>, which will be filled by using STACK.ADD. If the range is filled with cells, the existing cells will be moved defined by the direction parameter and the new cells will be added to the list. Values added to the StackRange have to use identical headers in both the Stack- and SourceRange. The STACK.ADD function automatically indexes the added items in the correct columns.

Syntax

=STACK.ADD(StackRange, SourceRange, [Direction], [TargetRange])

Arguments

NameTypeDescription
StackRangeRangeRange, where the source range items are added to. The first row of the StackRange is a title range and remains unchanged.
SourceRangeRangeRange, where the source data is taken from and copied into the StackRange.The first row of the StackRange is a title range and remains unchanged.
Direction (optional)BooleanIf you set Direction to TRUE the new data is added behind the last empty row on the SourceRange. If the StackRange is full, the first row (after the columns row) is dropped from the stack and all rows move up to make room for the new data in the last row. Analog, if Direction is set to FALSE rows are added at top of the stack and dropped from the bottom.

Default value: TRUE
TargetRange (optional)RangeIf TargetRange is specified and if a row has to be dropped, the row is copied to the TargetRange. TargetRange must have two rows, the first row has labels also found in Stackrange (not necessarily all and maybe not in the same order!). The dropped values are copied to the matching columns in the TargetRange. If no row is dropped, the values in the second row of TargetRange are blanked out. Important: Before copying to the TargetRange all existing values in TargetRange are deleted (not the labels row!)

Return

TypeDescription
Boolean or ErrorTRUE, if no error occurred, otherwise error value.

Examples

ABCD
1NameAgeCityStreet
2Maier43SidneyMain Street
3
4NameAgeCityStreet
5
FormulaResultComment
=STACK.ADD(A1:D4, A2:D3, TRUE)
After calling STACK.ADD the first