SUBSTITUTE
Swap matching text for replacement text, optionally limiting the change to one occurrence.
Syntax
=SUBSTITUTE(text, old_text, new_text, [instance_num])Worked example
Replace both hyphens with slashes.
=SUBSTITUTE("AB-2-4","-","/")Result AB/2/4
Microsoft documentation
Check the arguments, supported editions and behavior of this function in Microsoft’s reference.
Microsoft reference3 Advanced Examples of the SUBSTITUTE Function in Excel
Practice SUBSTITUTE
Replace both hyphens with slashes.
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 |
Show example formula
=SUBSTITUTE(B2,B3,B4) Lesson quiz
Answer three questions to see your level in this lesson.
