Also applies to:
REPLACEB
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. This function is for use with double-byte characters.
Syntax
REPLACE(old_text,start_num,num_chars,new_text)
REPLACEB(old_text,start_num,num_bytes,new_text)
Old_text is text in which you want to replace some characters.
Start_num is the position of the character in old_text that you want to replace with new_text.
Num_chars is the number of characters in old_text that you want REPLACE to replace with new_text.
Num_bytes is the number of bytes in old_text that you want REPLACEB to replace with new_text.
New_text is the text that will replace characters in old_text.
Example (REPLACE)
The example may be easier to understand if you copy it to a blank worksheet.
- Create a blank workbook or worksheet.
- Select the example in the Help topic. Do not select the row or column headers.
Selecting an example from Help
- Press CTRL+C.
- In the worksheet, select cell A1, and press CTRL+V.
- To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
|
|
Example (REPLACEB)
In the following example, the first three double-byte characters in cell C4 are replaced with "":
=REPLACEB(C4,1,6,"")