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
Name | Description |
---|---|
Start | A number to initialize the counter with. |
Step | Number which specifies the increment (positive number) or decrement (negative number) steps. |
End (optional) | Number or Condition which defines upper or lower bound. |
Reset (optional) | 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
Number
Examples
Formula | Result | Comment |
---|---|---|
| 2 | Will initialize counter with 2 and increment by 2 on each step, i.e.: 2, 4, 6,... |
| 10 | Will initialize counter with 10 and decrement by -2 on each step, i.e.: 10, 8, 6,... |
| 2 | Will initialize counter with 2 and resets it on each even step count, i.e.: 2, 3, 2, 3,... |
| 2 | Will count from 2 to 10 in steps of 2, i.e. 2, 4, 6, 8, 10 |
| 10 | Will count from 10 down to 0 in steps of -2, i.e. 10, 8, ..., 0 |
| 10 | Will not decrement since lower bound is greater then start value. |