Practice free

REPLACEB function

REPLACEB swaps out a section of text at a known position, counting bytes instead of characters. It differs from REPLACE only in East Asian language settings.

Example

Practice this in the app

Syntax

REPLACEB(old_text, start_num, num_bytes, new_text)

old_text (required)
The original text.
start_num (required)
Byte position where replacement begins.
num_bytes (required)
How many bytes to remove.
new_text (required)
Text to insert.

Returns: The text with that section replaced.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=REPLACEB("abcdef",2,3,"X") aXef Single-byte text
=REPLACEB("日本語",3,2,"X") 日本X Double-byte text

Watch out for

  • Same as REPLACE in non-double-byte settings.

Where it works

Excel
REPLACEB is in every version of Excel from 2007 on. Differs from the non-B version only in East Asian (double-byte) language settings.
Google Sheets
No direct equivalent. Use REPLACE.

Part of Text functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .