The function RANGE takes two Numbers and returns a List of Numbers spanning the first Number to the second in increments of either 1 (the default) or some other specified step (optional).
This function requires two Numbers as input. It outputs a List of Numbers spanning the first Number to the second. By default, the numbers in this List will increase by increments of one, though the RANGE function accepts another optional Number as input, specifying the increments between Numbers in the List.
RANGE(start, end, step) -> range
start (required, type:
In general, this Number will be the first item in the returned List.
end (required, type:
This number designates when the returned List will end; no number past this one will be included in the List. Depending on the value of step, this number will not necessarily be included at the end of the returned List itself.
step (optional, type:
Number, default: 1)
The desired increment to increase each Number in the returned List by.
The List of Numbers spanning from start to end by increasing each Number in the List in increments of step.
The following example returns a List spanning the numbers from 1 to 10. Note that the default value of step is 1, and so, as the list goes on, each Number is 1 more than the Number listed previous:
RANGE(1, 10) -> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
The following example returns a List spanning the numbers from 1 to 10 in increments of 2. Note that 10 itself is not included in the returned List:
RANGE(1, 10, 2) -> [1, 3, 5, 7, 9]
The following example attempts to return a list ranging from 10 to 1. However, the default value of step is positive 1, and there is no way to go from 10 to 1 by adding ones to the number ten. RANGE, therefore, returns a blank list:
RANGE(10, 1) -> 
In order for RANGE to return a List ranging from 10 to 1 – a List where the numbers decrease as the List goes on – a negative Number value must be specified for the value of step. The following example returns a list spanning from 10 to 1, where each number in the list decreases by 1:
RANGE(10, 1, -1) -> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]