SORTM (sort)

<< Click to Display Table of Contents >>

SORTM (sort)

Syntax:

SORTM(Range, Key [, Mode] [, Columnwise] [, Column])

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- or two-dimensional cell range or an array for this purpose.

Key is a two-row cell range or array containing the sort key(s): To do this, specify a two-row cell range or a two-row array with the following contents:

The first row must contain the relative row numbers of the rows to be sorted by. If, for example, you enter {1,3} for the sort key, the cell range is sorted by the first and by the third row of Range.

Its second row (optional) can contain logical values that specify the sort order:

FALSE or omitted: Ascending order

TRUE: Descending order

For example, if you use {1,3; true,false} as the sort key, the cell range is 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., place text strings starting with a lowercase letter above text strings starting with an 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 Column, the function returns only 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 is not supported by Microsoft Excel. If you save a document in Excel format, all calculations using this function will be replaced by their last result as a fixed value.

See also:

SORTV, section Sorting cells