# SELECT

The SELECT function returns the range of cells between the start and end columns of a specified measure. It should be used in conjunction with an aggregate function such as SUM, AVERAGE, RANK, etc.

## Syntax

```javascript
SELECT(measure,start_column,end_column)
```

## Arguments

measure - String. Specify the measure name for which the data range must be retrieved. Leaf-level cells will be taken.

start\_column - Number. The starting column index from which the data must be fetched (1-based indexing). Required.

end\_column - Number. The index of the ending column until which data has to be retrieved. Optional. If left blank, only the data from the start\_column will be returned.&#x20;

## Return value

Range of data.

## Example

{% code overflow="wrap" %}

```javascript
SELECT([Sales],1,3)

//Returns the range of cells between the first and the third column of the 'Sales' measure

SUM(SELECT([Sales],1,3))

//Calculates the sum of values from the first through third columns of the 'Sales' measure
```

{% endcode %}

In the example below, we used the SELECT function to determine the rank of multiple categories. The rank is derived from the first through fifth columns of the 'Sales' measure.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FX8u2o1Cs4LICMRLBNS2k%2Fimage.png?alt=media&#x26;token=6cf1ec38-d69c-4594-8cd0-071fb7ffbb96" alt=""><figcaption><p>SELECT with RANK</p></figcaption></figure>
