How to Use REPLACEB Function

The REPLACEB function replaces part of the text string with a new string based on the position and the number of bytes you specified. When a double-byte character set (DBCS, e.g., Japanese, Simplified Chinese, Traditional Chinese, and Korean) is set as the default language, each character will be counted as 2 bytes. Otherwise, the REPLACEB function is the same as REPLACE function.

Formula:

=REPLACEB(old_text, start_num, num_bytes, new_text)

Explanations:

– Old text is required, the text string that you want to be replaced;

– Start_num is required, the start point you want to be replaced in the old text string;

– Num_bytes is required, the number of bytes you want to be replaced in the old text string;

– New_text is required, the text that will replace the old characters.

Cautions:

– Spaces are counted as characters.

– The new text needs a quotation sign.

– When num_bytes is longer than the number of bytes after the starting point, all characters after the starting point will be replaced by the new text string.

– When Start_num is less than 1 (e.g., -5), the result returns the error of #VALUE!

Examples: Change letters "replaceb" in the text string "how to use replaceb function" with "REPLACEB".

= REPLACEB(A1,12, 8, "REPLACEB")

The result returns "how to use REPLACEB function".

Download: REPLACEB Function

Leave a Reply