> For the complete documentation index, see [llms.txt](https://docs.inforiver.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inforiver.com/formula-syntax/statistical-functions/rankavg.md).

# RANKAVG

Returns the rank/position of a number in a list of numbers.&#x20;

A number's rank refers to its size or value in comparison to the values of other numbers in a list. If you were to sort the list (ascending or descending), the rank of the number would be its position.

If more than one value has the same rank, the average rank is returned.

### Syntax

```javascript
RANKAVG(number, list, [order])
```

### Arguments

The RANKAVG function syntax has the following arguments:&#x20;

* number: The number whose rank you wish to find. Required.&#x20;
* list: A list of numbers, or a reference to it. Required.&#x20;
* order: A number that specifies whether the numbers should be ranked ascending or descending in the list. Optional.&#x20;

If the order is 0 (zero), Inforiver ranks the number as if the list is sorted in **descending order**. The highest value number is assigned a rank of 1, and so on.

If the order is omitted or any nonzero value is entered, Inforiver ranks the number as if the list is sorted in **ascending order**. The lowest value number is assigned a rank of 1, and so on.

### Example

```javascript
RANKAVG(2,[1,2,2,5,4],0)
// returns 3.5

RANKAVG(2,[1,2,2,5,4],1)
// returns 2.5
```

The RANKAVG function can be used to rank the values of multiple entities in important metrics such as score, cost, revenue, and sales, particularly when there is a possibility of more duplicate values.

In the example below, we have used the RANKAVG function to rank the sales across different product categories. The average rank is returned for duplicates.

<figure><img src="/files/Daotbv3BhRv9RvBiETRT" alt=""><figcaption><p>RANKAVG function</p></figcaption></figure>

{% hint style="info" %}
We used the [**SELECT**](/formula-syntax/measure-column-selection-functions/select.md) function to select a range of columns from 1 to 5 for the 'Sales' measure.
{% endhint %}

### Excel Equivalent

[RANKAVG](https://support.microsoft.com/en-us/office/rank-avg-function-bd406a6f-eb38-4d73-aa8e-6d1c3c72e83a)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inforiver.com/formula-syntax/statistical-functions/rankavg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
