REPLACE - Replacing Part of a Text

  • Last update:  2023-08-22
  • Usage 1: Replacing Specified Content of a Text

    Overview

    Grammar

    REPLACE(text,textorreplace,replacetext)

    Replaces the specified character string in the original text with a different character string.

    Parameter 1

    text

    Text or referenced cell containing the characters to be replaced

    Parameter 2

    textorreplace

    Specified character string

    Parameter 3

    replacetext

    Text in which the original character string needs to be replaced

    Notes

    • The function supports three parameters of any type.

    Example

    For example, if you want to replace Cold in the Product name column with Flu, as shown in the following figure.

    REPLACE1.png

    Add a calculation indicator and enter the formula REPLACE(Product name},"Cold","Flu"), as shown in the following figure.

    REPLACE2.png

    More examples:

    FormulaResultNotes
    REPLACE("abcd","a","re")rebcd-
    REPLACE("a**d","**d","rose")arose-

    Usage 2: Replacing the String Starting from a Specified Position of a Text

    Overview

    Grammar

    REPLACE(old_text,start_num,num_chars,new_text)

    Replaces a specified number of characters in a text, with a different character string.

    Parameter 1

    Old_text

    Text or referenced cell containing the characters to be replaced

    Parameter 2

    Start_num

    Starting position of the text where old_text is to be replaced with new_text

    Parameter 3

    Num_chars

    Number of characters in old_text to be replaced with new_text

    Parameter 4

    New_text

    Text in which the original character string needs to be replaced

    Notes

    • The function supports four parameters, among which the first and fourth are of any type, and the second and third are numeric.

    Example

    Take the data desensitization of telephone numbers as an example.

    FormulaResultNotes
    REPLACE("0123456789",5,4,"*")0123*89/
    REPLACE("1980",3,2,"99")1999/



    Attachment List


    Theme: Advanced Data Analyis
    前の記事
    次の記事
    • いいね
    • 良くない
    • 閲覧しただけ

    フィードバック

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭

    反馈已提交

    网络繁忙