Skip to main content

sortNumbers

Sorts a list of numbers in ascending order.

To sort in descending order, use sortNumbersReverse instead.

Parameters

  • LIST (list, column, or row)

    The list of numbers to sort.

Notes

  • You can give a row or column instead of a list.

  • The function returns an error if the input data contains non-numeric values.

Examples

To sort a list of numbers in ascending order:

ATL in Script

Printed Result

[[

myList = makeList(10, 20, 15, 30, 25)

sortNumbers(myList)

]]

10, 15, 20, 25 and 30

Assume a "Describe the Table" project with this data:

ID

Branch

State

Manager

Sales

Row 1

1001

Pittsburgh

Pennsylvania

Andrew Gray

478,745.37

Row 2

1002

Boston

Massachusetts

Emma Moore

329,493.49

Row 3

1003

Los Angeles

California

Linda Barclay

467,359.45

Row 3

1004

Chicago

Illinois

Camilla Scott

463,603.17

You can input a column variable to the first parameter:

ATL in Script

Printed Result

[[Sales]]

478,745.37, 329,493.49, 467,359.45 and 463,603.17

[[sortNumbers(Sales)]]

329,493.49, 463,603.17, 467,359.45 and 478,745.37

Note

In a "Describe Row in Context" project, the column variable would be SalesColumn.