dsSort


The dsSort is a special spreadsheet function supplied by Deriscope that creates a data array by sorting the source range (which is not altered) according to defined sorting keys.
The sorting keys can be any column or row of the source range, or even a portion of such a column or row.
For example, if the sorting keys are defined as the leftmost column of the source range, all rows are reshuffled so that the data of the leftmost column of the returned data appear sorted.
But if the sorting keys are defined as the top 3 cells of the leftmost column of the source range, only the top 3 rows are reshuffled so that the top 3 values of the leftmost column of the returned data appear sorted.
The case where the sorting keys are defined as the top row of the source range works similarly in a transposed fashion: All columns are reshuffled so that the data of the top row of the returned data appear sorted.
Similarly, if the sorting keys are defined as the leftmost 3 cells of the top row of the source range, only the leftmost 3 columns are reshuffled so that the leftmost 3 values of the top row of the returned data appear sorted.

This function takes at least 1 argument with 6 additional optional arguments and has the following form:

=dsSort( source, [keysFirstRow], [keysLastRow], [keysFirstColumn], [keysLastColumn], [ascending], [keyType] )

The arguments are as follows:

source: The range supplying the original data that need to be sorted. The existing data in that range are not affected.

keysFirstRow: The optional top row index (default = 1) of the sorting keys within the source range. 1 corresponds to the top row of the source range. It should equal keysLastRow if the sorting keys lie in a row.

keysLastRow: The optional bottom row index (default = 0) of the sorting keys within the source range. If less than keysFirstRow, the last row of the source range is assumed. It should equal keysFirstRow if the sorting keys lie in a row.

keysFirstColumn: The optional leftmost column index (default = 1) of the sorting keys within the source range. 1 corresponds to the leftmost row of the source range. It should equal keysLastColumn if the sorting keys lie in a column.

keysLastColumn: The optional rightmost column index (default = 0) of the sorting keys within the source range. If less than keysFirstColumn, the last column of the source range is assumed. It should equal keysFirstColumn if the sorting keys lie in a column.

ascending: Boolean value. Set TRUE to order the referenced keys in increasing fashion. Set FALSE to order them in decreasing fashion.

keyType: Optional integer from 0 to 4. If missing or 0, the type of sorted keys is implied from first key. Otherwise 1 -> text, 2 -> number, 3 -> boolean, 4 -> date