> For the complete documentation index, see [llms.txt](https://help.pickzen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.pickzen.com/guides/nocode/functions/rank.md).

# RANK

The RANK function returns a group with predefined keys from a table and values from a winner column. This is useful to compose personalized texts.

### Details

* It can also return a list of groups (columns)
* The columns are chosen using a point-based system.

### Syntax

**RANK(table, \[number])**

| Argument name                                 | Description                                                     |
| --------------------------------------------- | --------------------------------------------------------------- |
| <p><strong>table</strong></p><p>Required</p>  | Table to be evaluated.                                          |
| <p><strong>number</strong></p><p>Optional</p> | Number of groups (columns) to return. By default will return 1. |

**Table syntax**

| **Column name**                                          | Description                                                     |
| -------------------------------------------------------- | --------------------------------------------------------------- |
| <p><strong>key</strong></p><p>Required</p>               | Column with the group keys.                                     |
| <p><strong>\<other\_columns></strong></p><p>Required</p> | Column values. The header(s) with higher values will be chosen. |

### Examples

#### Example 1

If:

* type1=4, type2=6, type3=2

And the table is:

![table](https://1947171238-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LrTaL6FQB3RzlkCwQfN%2F-MA6rNCcrGzzH9yM2rdB%2F-MA7-P8iXm1BGmwxD-W0%2Fimage.png?alt=media\&token=6d31d3cd-dd21-46d2-9996-08330c0da183)

**RANK(table)** will return this group:

```
title: 'Title 2'
subtitle: 'Subtitle2'
```

**RANK(table, 2)** will return a list with these two groups:

```
title: 'Title 2'
subtitle: 'Subtitle2'

title: 'Title 1'
subtitle: 'Subtitle1'
```
