Please note javascript is required for full website functionality.

Blog

A to Z of Excel Functions: The REPLACEB Function

21 October 2024

Welcome back to our regular A to Z of Excel Functions blog.  Today we look at the REPLACEB function.

 

The REPLACEB function

The REPLACEB function replaces part of a text string (or should that be “sting”?), based upon the number of bytes you specify, with a different text string.  This function is not available in all languages.  REPLACE is intended for use with languages that use the single-byte character set (SBCS), whereas REPLACEB is anticipated for use with languages that use the double-byte character set (DBCS).

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

REPLACEB counts each double-byte character as two [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 one [1].

It has the following syntax:

REPLACEB(old_text, start_num, num_bytes, new_text)

The REPLACEB function has the following arguments:

  • old_text: this is required and represents the text in which you wish to replace some or all of the characters
  • start_num: this is also required.  This is the position of the character in old_text that you want to replace with new_text
  • num_bytes: this argument is also mandatory and denotes the number of bytes in old_text that you want REPLACEB to change for new_text
  • new_text: again required, this is the text that will replace the characters in the old_text.

Please see my examples below: 

We’ll continue our A to Z of Excel Functions soon.  Keep checking back – there’s a new blog post every business day.

A full page of the function articles can be found here


Newsletter