# RANKEQ

Returns the rank/position of a number in a list of numbers. 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 there are duplicates, their rank remains the same. The subsequent rank is skipped.

{% hint style="info" %}
**RANK** is the legacy version of the **RANKEQ** function and works similarly. It can be used in place of RANKEQ to return the rank of a number in a list of values.
{% endhint %}

### Syntax

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

### Arguments

The RANKEQ function syntax has the following arguments:

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

If the order is 0 (zero), Lumel Planning ranks the number as if the list were 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, Lumel Planning ranks the number as if the list were sorted in **ascending order**. The lowest value number is assigned a rank of 1, and so on.

### Example

<pre class="language-javascript"><code class="lang-javascript"><strong>RANKEQ(2,[1,3,2,5,4],0)
</strong>// returns 4

<strong>RANKEQ(2,[1,3,2,5,4],1)
</strong>// returns 2

<strong>RANKEQ(2,[1,3,2,5,4])
</strong>// returns 2

<strong>// with duplicates
</strong><strong>RANK(4,[1,2,2,5,4])
</strong>// returns 4
</code></pre>

You can use the **RANKEQ** function to rank the values of several entities in important metrics like score, cost, revenue, sales, and so on.

In the example below, we have used the RANKEQ function to rank the revenue across different product categories and regions.

<figure><img src="/files/lbQkcWJhwTUUyhWcZwAB" alt=""><figcaption><p>RANKEQ function</p></figcaption></figure>

{% hint style="info" %}
We can also use the [**SELECT**](/planning-sheets/formula-syntax/measure-column-selection-functions/select.md) function to select a range of columns from 1 to 4 for the 'Revenue' measure (2022 Revenue - 2025 Revenue).

<pre><code><strong>RANKEQ([Revenue], SELECT([Revenue], 1, 4), 0)
</strong></code></pre>

{% endhint %}

### Excel Equivalent

[RANKEQ](https://support.microsoft.com/en-us/office/rank-eq-function-284858ce-8ef6-450e-b662-26245be04a40)


---

# Agent Instructions: 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.fabricplan.com/planning-sheets/formula-syntax/statistical-functions/rankeq.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.
