The SUBSTITUTE function

Replaces existing text with new text, everywhere or only the n-th time it appears.

Syntax

SUBSTITUTE(text, old_text, new_text, [instance_num])
text
The text to change.
old_text
The text to replace.
new_text
The replacement. "" removes old_text.
instance_num (optional)
Which occurrence to replace. Left out, every one is replaced.

Examples

C1=SUBSTITUTE(A2,"-","")
ABC
1CodeDK2100
2DK-2100

In plain words: In the code in A2, replace every dash with nothing.

C1=SUBSTITUTE("a-b-c","-","/",2)
ABC
1Codea-b/c
2DK-2100

Practice SUBSTITUTE

Read the guide

Related functions