---
title: MID
description: Learn how to use the MID function to extract specific characters from text strings, perfect for creating calculated columns and manipulating data efficiently in your datasets.
---
import { Steps } from '@astrojs/starlight/components';

# MID

The MID function extracts a specified number of characters from a text string, starting at a specified position.

## Applicable to

Calculated Columns

## Return Value

* The MID function returns a text string containing the specified number of characters from the input text string, starting at the specified position.
* If start number is greater than the length of text, the function returns an empty string.
* If number character is greater than the number of characters remaining after the start position, the function returns all remaining characters.

## Remark

* If start number is less than 1, the function returns an empty string.
* If number character is less than 1, the function returns an empty string.
* If text is a NULL value, the function returns NULL.
* The first character in the text string starts at position 0.
* MID function is applicable only for text values

## Syntax

```
MID(<expression>,chars, start)
```

## MID in Calculated Columns



| Expression | A placeholder in a function that is replaced with the actual widget and measure names. |
|---|---|
| Column Name | The name of the column in the dataset or Datasource that contains the values you want to analyze. |
| Chars | Number of characters to extract from the text string |
| Start | Start position of characters to extract from the text string. |

Steps to Use MID Function

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


**Objective** Consider that you have the below dataset, your goal is shortening the product description.

| PRODUCT ID | PRODUCT NAME | DESCRIPTION |
|---|---|---|
| 1 | Apple iPhone 13 | The latest iPhone model from Apple. |
| 2 | Samsung Galaxy S21 | Samsung's flagship smartphone. |
| 3 | Google Pixel 6 | Google's premium Android smartphone. |

You can use the MID function like

```
MID(VALUE([DESCRIPTION]), 0,10)
```

The new calculated column "Short Description" will return 

| PRODUCT ID | PRODUCT NAME | DESCRIPTION | SHORT DESCRIPTION |
|---|---|---|---|
| 1 | Apple iPhone 13 | The latest iPhone model from Apple. | The latest |
| 2 | Samsung Galaxy S21 | Samsung's flagship smartphone. | Samsung's |
| 3 | Google Pixel 6 | Google's premium Android smartphone. | Google's p |

