# SUBSTITUTE

## Content

This function substitutes a new string for specified characters in an existing string.

## Syntax

`SUBSTITUTE(text, old_text, new_text, [instance_num])`

## Arguments

This function has these arguments:

| Argument | Description |
| -------- | ----------- |
| *text* | String or reference to a cell containing the string in which you want to replace characters |
| *old\_text* | String to be replaced |
| *new\_text* | New string to use instead of existing string |
| *instance\_num* | [Optional] Which occurrence of the existing string to replace; otherwise every occurrence is replaced |

## Remarks

Use this function to replace specific text with other text. Use the [REPLACE](/spreadjs/docs/v19/formulareference/FormulaFunctions/text-functions/REPLACE) function to replace a specific number of characters in a specific location with other characters.

## Data Types

Accepts string data for the *text* , *old\_piece* , and *new\_piece* arguments, and numeric data for the *instance* argument. Returns string data.

## Examples

`SUBSTITUTE("Down Trend","Down","Up")` gives the result Up Trend
`SUBSTITUTE("Feb 1, 1991","1","2", 3)` gives the result Feb 1, 1992