SORT

Sorts the specified list using an optional sort order and expression to control the ordering.

Syntax

=SORT(array)

=SORT(array, order)

=SORT(array, order, expression)

Arguments

ArgumentTypeDescription
arrayArrayThe array to sort
orderString(Optional) Ascending or descending order. Should be one of "ASC" or "DESC"
expressionAny(Optional) An expression that, when evaluated, is used to sort the array

Examples

=SORT(ARRAY(3, 1, 2, 4, 0))[0, 1, 2, 3, 4]
Sorts the array in ascending order based on value.

=SORT(children, "ASC")[Shape 1, Shape 2, Shape 3, Shape 4, Shape 5]
Sorts the list of children of the current shapes in ascending order, sorted by each child's text.

=SORT(children, "DESC", this."Property 1")[Shape 5, Shape 4, Shape 2, Shape 3, Shape 1]
Sorts the list of children of the current shapes in descending order, sorted by each child's shape data property "Property 1".