List.Numbers
ListGenerates a list of numbers starting from a given value, with a specified count and optional increment.
Syntax
List.Numbers(start as number, count as number, optional increment as nullable number) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
start | number | Yes | The starting number. |
count | number | Yes | The number of values to generate. |
increment | nullable number | No | The amount to add between each successive number. Defaults to 1 if not specified. |
Return Value
list — A list of numbers of length count, beginning at start and incrementing by the specified amount.
Remarks
List.Numbers generates an arithmetic sequence of numeric values — the numeric equivalent of List.Dates, List.Times, and related sequence generators. It is useful for creating index lists, generating test data, producing evenly-spaced values for axis labels, or building the basis for further transformations.
The increment parameter defaults to 1 if omitted or null. Use a negative increment to generate a decreasing sequence. Use a decimal increment for fractional steps (e.g., 0.1 for 10% increments, 0.25 for quarter-unit steps). A count of 0 returns an empty list.
For simple integer sequences starting at 0, the range literal {0..N} is more concise. For sequences starting at 1, {1..N} works equally well. List.Numbers is preferred when the start, count, or increment are dynamic values computed at runtime, or when the increment is non-integer.
Examples
Example 4: Decimal step (percentage increments)
List.Numbers(0, 5, 0.25)Result | |
|---|---|
| 1 | {0, 0.25, 0.5, 0.75, 1} |