# RANK.EQ function

RANK.EQ(Value, Array, Order?) RANK.EQ(Value; Array; Order?)

## Value

Number or { Number }

The value whose rank in the given array should be returned.

## Array

{ Number }

The array of values in which the given value is expected to appear.

## Order

SortOrder, Number, { SortOrder } or { Number } (optional)

The sort order. Use SortOrder.DescendingSortOrder,Descending or 0 for descending order (greater values appear first in the sorted array used to determine the rank) and SortOrder.AscendingSortOrder,Ascending or any number other than 0 for ascending order (greater values appear last in the sorted array). If omitted, descending order is used.

## Returns

Number or { Number }

The rank of the given number in the given number array.

Returns the rank of the given number in the given number array. RANK.EQ(10, { 10, 1, 100, 1000 })RANK.EQ(10; { 10; 1; 100; 1000 }) returns 3, because 10 is at the third position in a version of the given array that has been sorted in descending order.

Consider this formula, with an array containing two 10 elements:

RANK.EQ(10, { 10, 1, 100, 1000, 10 })RANK.EQ(10; { 10; 1; 100; 1000; 10 })

Sorting { 10, 1, 100, 1000, 10 }{ 10; 1; 100; 1000; 10 } in descending order yields the array { 1000, 100, 10, 10, 1 }{ 1000; 100; 10; 10; 1 }, where 10 appears at positions 3 and 4. RANK.EQ returns the lower rank, 3. RANK.AVG would instead return the average of these two positions, 3.5.

The third, optional parameter may be given to specify the sort order. Use SortOrder.DescendingSortOrder,Descending or 0 for descending order (greater values appear first in the sorted array) and SortOrder.AscendingSortOrder,Ascending or any number other than 0 for ascending order (greater values appear last in the sorted array). This function accepts numbers in addition to descriptive names for the sort order to ensure compatibility with spreadsheets.

## Examples

RANK.EQ(10, { 10, 1, 100, 1000 })RANK.EQ(10; { 10; 1; 100; 1000 })

Returns 3, because 10 is at the third position in a sorted version of the given array, sorted in descending order.

RANK.EQ(10, { 10, 1, 100, 1000, 10 })RANK.EQ(10; { 10; 1; 100; 1000; 10 })

Returns 3. 10 appears twice in the given array, at positions 3 and 4 in a sorted version of the array, sorted in descending order. RANK.EQ returns the lower rank, 3. RANK.AVG would instead return the average of these two positions, 3.5.

RANK.EQ(10, { 10, 1, 100, 1000 }, SortOrder.Descending)RANK.EQ(10; { 10; 1; 100; 1000 }; SortOrder,Descending)

Returns 3, because 10 is at the third position in a sorted version of the given array, sorted in descending order. The sort order can be specified explicitly.

RANK.EQ(10, { 10, 1, 100, 1000 }, SortOrder.Ascending)RANK.EQ(10; { 10; 1; 100; 1000 }; SortOrder,Ascending)

Returns 2, because 10 is at the second position in a sorted version of the given array, sorted in ascending order.

RANK.EQ(10, { 10, 1, 100, 1000 }, 0)RANK.EQ(10; { 10; 1; 100; 1000 }; 0)

Returns 3, because 10 is at the third position in a sorted version of the given array, sorted in descending order. The sort order can be specified explicitly. This function accepts a numeric sort order to ensure compatibility with spreadsheets.

RANK.EQ(10, { 10, 1, 100, 1000 }, -1)RANK.EQ(10; { 10; 1; 100; 1000 }; -1)

Returns 2, because 10 is at the second position in a sorted version of the given array, sorted in ascending order. The sort order can be specified explicitly. This function accepts a numeric sort order to ensure compatibility with spreadsheets.