To replace or substitute all occurrences of one character with another character, you can use the SUBSTITUTE function. In the example shown, the formula in C6 is:

=SUBSTITUTE(B6," ","-")

Generic formula



The SUBSTITUTE function is full automatic. All you need to do is supply "old text" and "new text". SUBSTITUTE will replace every instance of the old text with the new text.

If you need to perform more than one replacement at the same time, you'll need to nest multiple SUBSTITUTE functions. See this "clean telephone numbers" formula for an example.

If you need to replace a character at a specific location, see the REPLACE function.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.