Power Query
published
Search
⌃K

List.Alternate

List.Alternate

Returns a list comprised of all the odd numbered offset elements in a list.
function (list as list, count as number, optional repeatInterval as nullable any, optional offset as nullable any) as list

Description

Returns a list comprised of all the odd numbered offset elements in a list. Alternates between taking and skipping values from the list list depending on the parameters.

Category

List.Selection

Examples

Create a list from {1..10} that skips the first number.
List.Alternate({1..10}, 1)
{2, 3, 4, 5, 6, 7, 8, 9, 10}
Create a list from {1..10} that skips the every other number.
List.Alternate({1..10}, 1, 1)
{2, 4, 6, 8, 10}
Create a list from {1..10} that starts at 1 and skips every other number.
List.Alternate({1..10}, 1, 1, 1)
{1, 3, 5, 7, 9}
Create a list from {1..10} that starts at 1, skips one value, keeps two values and so on.
List.Alternate({1..10}, 1, 2, 1)
{1, 3, 4, 6, 7, 9, 10}