SORT

The SORT function accepts a series of values and returns an array of values sorted in ascending order. It is commonly used to arrange numeric data for comparison, ranking, and analytical calculations. Since the function returns an array, individual elements can be accessed using their index positions.

To sort in descending order use the SORTDESC function.

Syntax

SORT(value1, [value2], ...)

Arguments

  • value1: The first value to sort.
  • value2, ... (Optional): Additional values to include in the sorting operation.

Return value

Returns an array of values sorted in ascending order.

Example

Consider a scenario where quarterly actuals values need to be analyzed to identify the lowest and second-lowest actuals amounts. The SORT function can be used to sort the quarterly actuals values for each row in ascending order.

In this example, the variable a stores the array returned by the SORT function. The lowest quarterly revenue can then be accessed using a[0], while the highest quarterly revenue can be accessed using a[3].

Excel equivalent

SORT

Enterprise planning, Integrated with PowerTable and Intelligence, native to Microsoft Fabric. Co Engineered with Lumel.
BUILT ON