Name

REPLACE

Synopsis

Use REPLACE to replace the specified number of characters in a text string with a new string.

To Calculate

=REPLACE(Old_Text, Start_Num, Num_Chars, New_Text)

All arguments are required for this function.

Example

Figure 18-6 illustrates how to use REPLACE to replace the characters in a string of text at the specified location. This function only replaces the characters indicated. In this example, we replaced five characters starting at position 11 (the word Excel). On the other hand, SUBSTITUTE finds the specified characters in the string and replaces them with the new string.

This example also shows how to use REPT to repeat a string within a cell, SEARCH to determine the location of characters in a string, and T to return the text reference.

Use REPLACE to replace text at a known location; use SUBSTITUTE to replace text that matches specified criteria

Figure 18-6. Use REPLACE to replace text at a known location; use SUBSTITUTE to replace text that matches specified criteria

Get Excel 2000 in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.