RANK.AVG function
Value
The value whose rank in the given array should be returned.
Array
The array of values in which the given value is expected to appear.
Order
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
The rank of the given number in the given number array.
Returns the rank of the given number in the given number array. RANK.AVG(10, { 10, 1, 100, 1000 })RANK.AVG(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:
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.AVG returns the average of these two positions, 3.5. RANK.EQ would instead return the lower rank, 3.
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
Returns 3, because 10 is at the third position in a sorted version of the given array, sorted in descending order.
Returns 3.5. 10 appears twice in the given array, at positions 3 and 4 in a sorted version of the array, sorted in descending order. RANK.AVG returns the average of these two positions, 3.5. RANK.EQ would instead return the lower rank, 3.
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.
Returns 2, because 10 is at the second position in a sorted version of the given array, sorted in ascending order.
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.
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.