rank() Function

Returns an integer representing the rank of the number in the specified array.

Syntax

rank( number, array, [order] )

number: (Decimal) The number to be ranked

array: (Decimal Array) An array of numbers containing the number to be ranked

order: (Number) Use 0 to rank the array elements from high to low and 1 to rank the array in ascending order.

Returns

Integer

Examples

You can experiment with this function in the test box below.

Test Input

rank(2,{1,2,3,4},0) returns 3

FEEDBACK