REPLACE

Formula Explanation

The REPLACE function replaces a portion of a text string with a different text string based on the specified character count.

Formula Syntax

Enter in the result column: REPLACE(old_text, start_num, num_chars, new_text)

The REPLACE function syntax has the following arguments:

  • old_text (required): The text in which you want to replace some characters.

  • start_num (required): The position in old_text where the replacement will begin.

  • num_chars (required): The number of characters you want to replace in old_text with new_text.

  • Num_bytes (required): The number of bytes you want to replace in old_text with new_text (used with REPLACEB).

  • new_text (required): The text that will replace the characters in old_text.

Usage Example

  1. Replace "happy" with "HAPPY" in column EA2 and write the result in column EA3:
EA3 = replace(EA2, "happy", "HAPPY")

replace

  1. In "abcdefghijk," starting from the sixth character (f), replace five characters with a single asterisk (*):
REPLACE("abcdefghijk", 6, 5, "*")
  1. Replace the last two digits (09) of "2009" with "10": Result: "2010"
REPLACE("2009", 3, 2, "10")
  1. Replace the first three characters of "123456" with a single "@" character: Result: "@456"
REPLACE("123456", 1, 3, "@")
Last Updated: