The use of Replace and ReplaceB function in Excel

This article describes the formula syntax and usage of the REPLACE and REPLACEB function in Excel.

Description

REPLACE replaces part of a text string, based on the number of characters you specify, with a different text string.

REPLACEB replaces part of a text string, based on the number of bytes you specify, with a different text string.

Important:

    • These functions may not be available in all languages.

  • REPLACE is intended for use with languages that use the single-byte character set (SBCS), whereas REPLACEB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

    • REPLACE always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

  • REPLACEB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, REPLACEB counts each character as 1.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

Syntax

REPLACE(old_text, start_num, num_chars, new_text)

REPLACEB(old_text, start_num, num_bytes, new_text)

The REPLACE and REPLACEB function in excel syntax has the following arguments:

    • Old_text Required. Text in which you want to replace some characters.

    • Start_num Required. The position of the character in old_text that you want to replace with new_text.

    • Num_chars Required. The number of characters in old_text that you want REPLACE to replace with new_text.

    • Num_bytes Required. The number of bytes in old_text that you want REPLACEB to replace with new_text.

  • New_text Required. The text that will replace characters in old_text.

Example


Our active volunteer Aman Madaan prepared an excel sheet where you can have a look at Replace formulaes like he did it earlier for Paste Special here. The exercise will give you an idea on how to use such function.

You can download The Actuarial Club’s Forum app and subscribe the Excel forum to receive notification for any new exercise!

About the Author

Mayank Goyal

Facebook Twitter

Redmond Lover(Microsoft), London Dreamer(Actuary), California Thinker(Entrepreneur). Actuarial Science, Blogger, Web Developing, Winphan India, App development, Social Media Managing, Event Managing & bla bla bla.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.