<< Click to Display Table of Contents >> SORTM (sort) |
Syntax:
SORTM(Range, Key [, Mode] [, Columnwise] [, ColumnNumber])
Description:
This function sorts a cell range or an array according to one or more criteria and returns an array with the sorted values.
Range is the cell range or array containing the data to be sorted. You can specify a one-dimensional or two-dimensional cell range or an array for this purpose.
Key determines by which rows the cell range or array should be sorted. To do so, specify a two-row cell range or a two-row array with the following contents:
The first row must contain the numbers of the rows by which you want to sort. If, for example, you enter {1,3} for the sort key, the cell range will be sorted by the first and by the third row of Range.
The second row (optional) can contain logical values that specify the sort order:
FALSE or omitted: Ascending order
TRUE: Descending order
If, for example, you use {1,3; true,false} as the sort key, the cell range will be sorted by the first row in descending order and by the third row in ascending order.
Mode (optional) is a logical value that lets you specify if PlanMaker should distinguish between uppercase and lowercase letters:
FALSE or omitted: Ignore case of letters
TRUE: Distinguish between uppercase and lowercase letters, i.e., sort terms where the first letter is lowercase before terms that begin with the same uppercase letter.
Columnwise (optional) is a logical value that lets you specify if the data should be sorted row-wise or column-wise:
FALSE or omitted: Sort row-wise
TRUE: Sort column-wise
If you use the optional argument ColumnNumber, the function only returns a specific column (or row – if sorted column-wise) instead of the entire data:
If omitted, all columns are returned.
If set to n, only the n-th column is returned.
Note:
Formulas using this function have to be entered as an array formula. For more information, see Working with arrays.
Example:
SORTM({4;2;3}, {1}) returns {2;3;4}
SORTM({4;2;3}, {1;TRUE}) returns {4;3;2}
Compatibility notes:
This function does not exist in Microsoft Excel. If you save a document in Excel format, all calculations using this function will be replaced with their current result as a fixed value.
See also:
SORTV, section Sorting cells