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
| Range | The 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:
C1or1 - Skip lines:
0
- Sort Column Index:
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 | ||
| Sector | Constituents | Value |
| Basic Materials | 40 | 6000 |
| Consumer Goods | 21 | 2011 |
| Consumer Goods | 12 | 3000 |
| Telecommunications | 12 | 1200 |
| Health Care | 40 | 2500 |
| Industrials | 12 | 7800 |
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 | ||
| Sector | Constituents | Value |
| Basic Materials | 40 | 6000 |
| Consumer Goods | 12 | 3000 |
| Consumer Goods | 21 | 2011 |
| Health Care | 40 | 2500 |
| Industrials | 12 | 7800 |
| Telecommunications | 12 | 1200 |
