Skip to main content

RANKED

RANKED(position, set [ ,DESCEND ])

positionAn integer indicating the element in the unsorted set to return.
setThe set of values.
DESCENDOptional. Indicates descending order sort.
Return:RANKED returns a single value.

The RANKED function sorts the set in ascending (or descending, if DESCEND is present) order, then returns the ordinal position (its index value) of the sorted set's position element in the unsorted set. This is the opposite of RANK.

Example:

Ranking := RANKED(1,[20,30,10,40]);
// returns 3 - 1st element (10) in sorted set [10,20,30,40]
// was 3rd element in unsorted set

Ranking := RANKED(1,[20,30,10,40],DESCEND);
// returns 4 - 1st element (40) in sorted set [40,30,20,10]
// was 4th element in unsorted set

See Also: RANK, SORT, SORTED, Sets and Filters