Excel REPLACE Function

Using the Excel REPLACE Function


The Excel REPLACE function will replace a portion of a text string, based on the number of characters specified, with a new text string.

REPLACEB performs the same function, but the portion of text replaced is based on the number of specified bytes.

Use REPLACE when working with single-byte character sets (SBCS) and REPLACEB when working with double-byte character sets (DBCS). Languages that support DBCS include Japanese, Chinese (Simplified and Traditional), and Korean.


=REPLACE (old_text, start_num, num_chars, new_text)

=REPLACEB (old_text, start_num, num_bytes, new_text)

Syntax Breakdown

Old Text
Required. Existing text in which you want to replace one or more characters.

Start Num
Required. Position of the character in old_text that will be replaced with new_text. The first character in the string is considered position 1.

Num Chars
Required. Number of characters in old_text that will be replaced with new_text.

Num Bytes
Required if using REPLACEB. Number of bytes in old_text that will be replaced with new_text.

New Text
Required. The text that will replace old_text.

Usage Notes

The REPLACE function is used to find a portion of text in an existing text string and replace it with new text. REPLACE will always count each character as 1, regardless of whether it is a SBCS or DBCS.