The REPLACEB function replaces part of a text string, based on a number of bytes, with a different text string.

Parts of a REPLACEB function

REPLACEB(text, position, num_bytes, new_text)

PartDescription
textThe text, a part of which will be replaced.
positionThe position where the replacement will begin (starting from 1).
num_bytesThe number of bytes in the text to be replaced.
new_textThe text which will be inserted into the original text.

Notes

  • REPLACEB returns the same value as REPLACE if the input text has only single byte characters
  • This function returns text as the output. If a number is desired, try using the VALUE function in conjunction with this function.

Examples

ABC
1InputFormula
2Aeñds=REPLACEB(A2, 2, 3,"new")
3Aeñds=REPLACE(A3, 2, 3,"new")
4熊本=熊本=REPLACEB(A4, 2, 3,"new")
5熊本=熊本=REPLACE(A5, 2, 3,"new")
  • LENB: The LENB function returns the length of a string in bytes.
  • LEFTB: The LEFTB function returns the left portion of a string up to a certain number of bytes.
  • RIGHTB: The RIGHTB function returns the right portion of a string up to a certain number of bytes.
  • MIDB:The MIDB function returns a section of a string starting at a given character and up to a specified number of bytes.