SORTBY (PQL - xl)

This function sorts the data in a cell range or an array. The cell contents are extracted from the source array, the data is sorted and the results spill into the resultant range with a dynamic array of values arranged in ascending or descending order. Users can sort the values by one or more columns in the spreadsheet as per custom requirements

  • Library: PQL \ Spreadsheet \ Lookup
  • Compatibility: Any content (regardless of data source) in the Tabulate spreadsheet module

Syntax

SORTBY(array, by array, OPTIONAL sort order)

Function Arguments

Name

Description

Type

Optional

array

Specifies the range or array that you want to sort

StringOrNumber

by array

Specifies the array or range of the first sort key

StringOrNumber

sort order

Specifies the sort order. The value 1 indicates ascending order and the value -1 indicates descending order. The default value is 1 i.e. ascending

Number

Y

Comments

This function is the same as the Microsoft Excel 'SORTBY' function - using the same inputs, logic and outputs.