List.Skip
ListSkips the first N items of a list (or items while a condition is true) and returns the remaining items.
Syntax
List.Skip(list as list, countOrCondition as any) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The source list. |
countOrCondition | any | Yes | A number specifying how many items to skip, or a condition function that skips items while it returns true. |
Return Value
list — A new list with the first N items (or leading items matching the condition) removed.
Remarks
List.Skip removes items from the beginning of a list and returns all remaining items. It is functionally identical to List.RemoveFirstN — the two functions behave the same way. Use whichever reads more naturally in context.
When passed a number N, it skips the first N items. If N is greater than the list length, an empty list is returned. When passed a condition function, items are skipped from the start of the list while the condition returns true. Skipping stops permanently at the first item that fails the condition — subsequent items (even if they would satisfy the condition) are not skipped.
The condition mode is useful for advancing past a leading section — for example, skipping all rows before the first non-null value, or advancing past dates before a given date. For pagination, combining List.Skip and List.FirstN is the standard pattern: skip pageSize * (page - 1) items, then take pageSize.
Examples
Example 2: Skip items while they are less than 30
List.Skip({10, 20, 30, 40, 50}, each _ < 30)Result | |
|---|---|
| 1 | {30, 40, 50} |
Example 3: Paginate through a list (page 2 of 3)
let
AllItems = List.Numbers(1, 15),
PageSize = 5,
Page = 2,
PageItems = List.FirstN(List.Skip(AllItems, PageSize * (Page - 1)), PageSize)
in
PageItemsThe final output — the five items that make up page 2 of the paginated list.
Result | |
|---|---|
| 1 | {6, 7, 8, 9, 10} |