---
title: RIGHT
description: Learn how to use the RIGHT function to extract characters from the end of a text string in calculated columns.
---
import { Steps } from '@astrojs/starlight/components';

# RIGHT

The RIGHT function returns a specified number of characters from the right side of a text string.

## Applicable to

Calculated Columns

## Return Value

* The RIGHT function returns a text string containing the specified number of characters from the right side of the input text.
* If the number character is greater than the length of text, the entire text string is returned.

## Remark

* The RIGHT function is useful for extracting a substring from the beginning of a text string. 
* If number character is less than 1, the function returns an empty string.
* If the value is a NULL value, the function returns NULL.

## Syntax

```
RIGHT(<expression>,number)
```

## RIGHT in Calculated Columns



| Parameter      | Description                                                                        |
|-----------------|------------------------------------------------------------------------------------|
| Expression      | A placeholder in a function that is replaced with the actual column name.          |
| Column Name    | The name of the column in the dataset or Datasource that contains the values you want to analyze. |
| number          | Number of characters you want to extract from the left side of the string.       |

Steps to Use

<Steps>
1. Write the RIGHT function. For instance ```RIGHT(<expression>,number)```
2. Replace `<expression>` with `VALUE([Column Name])` and replace `number` with the number of characters you want to extract position of.Replace the **Column Name** with the actual name of your column required.
3. To learn how to add calculated columns in Infoveave, visit the section [Calculated Columns](/studio-v8/datasources/calculated-columns-datasource/).
</Steps>

**Example**

**Objective** Consider that you have the below sales dataset, your goal is extracting the first 2 substrings in CATEGORY from right.

| ORDER DATE | COUNTRY | CATEGORY   | UNIT PRICE | MARKET PRICE | QUANTITY |
|------------|---------|-------------|------------|--------------|----------|
| 2024-01-03 | Brazil  | Baby Food   | 38.41      | 43.7874       | 2        |
| 2024-01-07 | Japan   | Spices      | 45.56      | 50.8155       | 20       |
|            | Japan   |             |            | 43.7874       | 10       |
| 2024-01-18 |         |             |            | 32.3019       | 4        |
| 2024-01-22 | Brazil  | Cosmetics   | 28.335     | 23.0109       | 7        |
| 2024-01-26 | Canada  |             | 20.185     | 23.0109       | 9        |
| 2024-01-04 | France  | Cereal      | 25.26      | 28.7964       | 9        |
| 2024-01-09 | Brazil  | Cereal      | 44.575     | 50.8155       | 8        |
| 2024-01-14 | Brazil  | Snacks      | 20.185     |              | 4        |
|            | Brazil  | Cosmetics   | 40.485     | 46.1529       | 2        |

You can use the RIGHT function like

```
RIGHT(VALUE([CATEGORY]), 2)
```

The new calculated column "Text" will return

| ORDER DATE | COUNTRY | CATEGORY   | UNIT PRICE | MARKET PRICE | QUANTITY | TEXT |
|------------|---------|-------------|------------|--------------|----------|------|
| 03-01-2024 | Brazil  | Baby Food   | 38.41      | 43.7874       | 2        | od   |
| 07-01-2024 | Japan   | Spices      | 45.56      | 50.8155       | 20       | es   |
|            | Japan   |             |            | 43.7874       | 10       |      |
| 18-01-2024 |         |             |            | 32.3019       | 4        |      |
| 22-01-2024 | Brazil  | Cosmetics   | 28.335     | 23.0109       | 7        | cs   |
| 26-01-2024 | Canada  |             | 20.185     | 23.0109       | 9        |      |
| 04-01-2024 | France  | Cereal      | 25.26      | 28.7964       | 9        | al   |
| 09-01-2024 | Brazil  | Cereal      | 44.575     | 50.8155       | 8        | al   |
| 14-01-2024 | Brazil  | Snacks      | 20.185     |              | 4        | ks   |
|            | Brazil  | Cosmetics   | 40.485     | 46.1529       | 2        | cs   |


