Skip to main content
Version: Streamsheets 2.4

COUNTER

Increments or decrements a cell value by specified step amount. The initial value is defined by "Start" parameter. An optional "End" parameter can be set to define a lower or upper bound. Furthermore an optional "Reset" flag can be used to restart counter if its value evaluates to TRUE.

Syntax

=COUNTER(Start, Step [, End, Reset])

Arguments

NameDescription
StartA number to initialize the counter with.
StepNumber which specifies the increment (positive number) or decrement (negative number) steps.
EndOptional. Number or Condition which defines upper or lower bound.
ResetOptional. If it evaluates to TRUE the counter is reset to Start. Defaults to FALSE. Since immediately resets if TRUE, mostly used as a condition or reference on a condition.

Return Value

Number

Example

FunctionResultComment
=COUNTER(2, 2)2Will initialize counter with 2 and increment by 2 on each step, i.e.: 2, 4, 6,...
=COUNTER(10, -2)10Will initialize counter with 10 and decrement by -2 on each step, i.e.: 10, 8, 6,...
=COUNTER(2, 1, ,GETSTEP() % 2 <> 0)2Will initialize counter with 2 and resets it on each even step count, i.e.: 2, 3, 2, 3,...
=COUNTER(2, 2, 10)2Will count from 2 to 10 in steps of 2, i.e. 2, 4, 6, 8, 10
=COUNTER(10, -2, 0)10Will count from 10 down to 0 in steps of -2, i.e. 10, 8, ..., 0
=COUNTER(10, -2, 26)10Will not decrement since lower bound is greater then start value.