Excel - REPLACEB Function



REPLACEB Function

The EXCEL REPLACEB function is used to interchange a certain number of characters based on the number of bytes with a second string. Unlike the REPLACE function, the REPLACE function is especially helpful for DBCS-aided foreign languages like Japanese, Chinese(Simplified), and Korean. You can modify the default preferred language of Excel, English, to the DBCS-supported language to execute this function; otherwise, it acts like a REPLACE function.

Compatibility

This advanced Excel function is compatible with the following versions of Microsoft Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016

Syntax

The syntax of REPLACEB function is as follows −

=REPLACEB(old_text, start_num, num_bytes, new_text)

Arguments

You can use the following arguments with the REPLACEB function −

Argument Description Required / Optional
old_text It specifies the text from where the characters are being interchanged. Required
start_num It denotes the starting position of the characters in the old text interchanging with the new_text. Required
num_bytes It denotes the total number of bytes used to replace characters. Required
new_text Another text from where the characters is selected and interchanges in the old_text. Required

REPLACEB Function in Excel

The REPLACEB function in Excel is specifically designed for use byte count, ideal for languages with double-byte characters like Chinese or Japanese.

The step by step explanation are given below −

Step 1 − Deliberate an Excel sheet and double click on the targeted cell.

Step 2 − Type the = sign and then REPLACEB(old_text, start_num, num_bytes, new_text).

Step 3 − Hit the Enter button.

Examples of REPLACEB Function

Lets elaborate a few examples of the REPLACEB function in Microsoft Excel.

Example 1

Step 1 − MIS executives usually handle patient data in MNB hospitals. A few characters in patient names need to be corrected in Chinese. You can utilize the REPLACEB function to correct the patient's name.

REPLACEB Function in Excel

Step 2 − Enter the formula =REPLACEB(A2,6,10,B2) in the C2 cell and hit Enter.

REPLACEB Function in Excel 1

Therefore, the REPLACEB function will retrieve the correct name of the patient.

REPLACEB Function in Excel 2

Step 3 − You can write the formula =REPLACEB(A3,5,16,B3) in the C3 cell and press the Enter button.

REPLACEB Function in Excel 3

Hence, the correct name is retrieved by the REPLACEB function.

REPLACEB Function in Excel 4

Note − You can use the TRANSLATE feature to convert these words into English.

Example 2

Compute the REPLACEB function using the Korean language.

Solution

Step 1 − Assume the sample dataset where old and new text are written in Korean in C2 and C3 cells.

REPLACEB function using the Korean language

Step 2 − Enter the formula =REPLACEB(C2,1,1, C3) in the C4 cell.

REPLACEB function using the Korean language 1

Explanation

=REPLACEB(C2,1,1, C3)
  • The first argument represents C2 cell reference points to the value.
  • The second argument denotes the 1, which is the old text's starting point.
  • The third argument, 1, indicates the number of bytes to be interchanged with the new text string, which means the first characters in the old text are replaced by the new text string.
  • The fourth argument points to the C3 cell reference whose value is .

Step 3 − Once you press the Enter button, the REPLACEB function will return the value.

REPLACEB function using the Korean language 2

Similarly, you can deploy the REPLACEB function to correct the serial numbers written in Japanese/Korean. If you are using English, the REPLACEB function will give you the same output as the REPLACE function.

Download Practice Sheet

You can download and use the sample data sheet to practice the REPLACEB function.

Advertisements