Functions Utility

SortData

The SortData() function takes a range of data as input and sorts that range according to any column or hierarchy of columns. If multiple heading rows from the input range need to be included in the output, the headings can be skipped during the sort so that they appear in the correct position.


Syntax:

Qx.SortData(Range, [Sort Column Index], [Skip lines])
  • In Excel with Quintessence add-in versions prior to 25.1, use: SortData()
  • In the Quintessence Editor (Studio) using Quintessence language, use: SortData()
  • In the Quintessence Editor (Studio) using Python language, use: Qx.SortData()
 See parameter descriptions

RangeThe range to be sorted.
Sort Column Index
(optional)
A comma separated list of integers indicating sort order. Sorting hierarchy is evaluated from left to right in the list.

• Positive integers → ascending order
• Negative integers → descending order

Notation may use integers (e.g., 1,-2) or column notation (e.g., C1,-C2).
Skip lines
(optional)
Indicates how many lines from the top of the range should be excluded from the sort.

Remarks:

  • The default parameters are:
    • Sort Column Index: C1 or 1
    • Skip lines: 0

Examples:

The examples provided below are based on fictitious data for illustrative purposes only.

> Example 1: Sort data by multiple columns while skipping lines


Data range (A1:C8):

31-Mar-15
SectorConstituentsValue
Basic Materials406000
Consumer Goods212011
Consumer Goods123000
Telecommunications121200
Health Care402500
Industrials127800

Sort the range by:

  • Column 1 (ascending)
  • Column 3 (descending)
  • Skip the first 2 lines

Function call:

=Qx.SortData(A1:C8, "1,-3", 2)

Result:

31-Mar-15
SectorConstituentsValue
Basic Materials406000
Consumer Goods123000
Consumer Goods212011
Health Care402500
Industrials127800
Telecommunications121200