Skip to main content
← All functions

SUBSTITUTE function

Substitutes new text for old text in a text string

Syntax

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

Square brackets indicate optional arguments.

Arguments

ArgumentRequiredMeaning
textYesThe text or the reference to a cell containing text for which you want to substitute characters."Hello Univer"
old_textYesThe text you want to replace."Hello"
new_textYesThe text you want to replace old_text with."Hi"
instance_numNoSpecifies which occurrence of old_text you want to replace with new_text. If you specify instance_num, only that instance of old_text is replaced. Otherwise, every occurrence of old_text in text is changed to new_text.1

Try SUBSTITUTE

Replace a matching text fragment

=SUBSTITUTE(B2,"Har","Ar")

Replace a matching text fragment. The result is checked against a separately authored expected value for the supplied table. You can edit the data to explore the rule.

Inspect the current formula

Read its written arguments or observe actual operation values in a separate local calculation. This action neither applies a draft nor grades an answer.

Read the formula, one argument at a time

Explore the written function calls and their inputs. The calculation result belongs to the complete formula.

SUBSTITUTE · top-level call

=SUBSTITUTE(B2,"Har","Ar")

1 / 3 · text

The text or the reference to a cell containing text for which you want to substitute characters.

SUBSTITUTE reference ↗

Follow the cells behind a result

Read explicit local references and helper formulas using a separate calculation. Your draft stays in this field; the worksheet and practice checks do not change.

The worksheet runs locally. Published checks apply to the supplied example only. Native Excel and Google Sheets compatibility remain unverified.

Clean a complete batch

Keep original records, apply exact-prefix and selected-occurrence rules, and compare every intermediate result.

Open targeted text cleanup practice →

Practice a complete task

Reference and compatibility

Univer 1.0.4 / Apache-2.0. Calculation checks cover the supplied examples only. The browser worksheet does not implement every Excel feature, external service or connected data type.