SUBSTITUTE()

Syntax. SUBSTITUTE(text,old_text,new_text,instance_num)

Definition. The SUBSTITUTE() function replaces characters or strings with new text.

Arguments

Background. Use this function to replace a string of text with alternative text. The replacement can be for a single or for multiple instances.

You can use the SUBSTITUTE() function to replace a specific string within text. Use the REPLACE() function to replace a string at a certain position within text.

Important

The SUBSTITUTE() function is case-sensitive when it is searching for old_text.

ExampleSuppose you want to replace German special characters; for example, ä with ae, ö with oe, and ü with ue. To do this, you nest the SUBSTITUTE() function three times:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE("Dönerverkäuferprüfung","ä","ae"),"ö","oe"),"ü","ue")

This results in Doenerverkaeuferpruefung. Here are a few more examples:

  • =SUBSTITUTE("intercontinentalflight","flight","drive") results in intercontinentaldrive.

  • =SUBSTITUTE("cell","l","t",2) results in celt.

  • =SUBSTITUTE("vetter","tt","nt",1) results in venter.

  • =SUBSTITUTE("canter","A","e")results in canter.

  • =SUBSTITUTE("million","m","b") results in billion.

See Also

FIND(), REPLACE(), REPLACEB(), SEARCH(), TRIM()