The formula for the Substitute function is: The formula for the Replace function is:
Syntax of Substitute and Replace Functions
Substitute Function
Text: The Text or cell in which you want to substitute characters. Required.Old_text: The Text you want to replace. RequiredNew_text: the text you want to replace the old_text with. Required.Instance_ num: Specifies which old_Text you want to replace with the new_ Text. Optional.
Replace Function
Old_text: The text you want to replace. Required.Start_num: The position of the character you want to replace in the old_text.Num_chars: The number of characters in old_ text you want to replace with new_text.New_text: The text that will replace the characters in the old_ text.
How to use the Substitute function in Excel
Open Microsoft Excel. Create a table or use an existing table.
In this tutorial, we have the text ‘hhans 1997‘ in the text column; we want to substitute the’ h‘ with an ‘s.’ Click the cell where you want to place the result. Type in the Cell = Substitute, then bracket. Inside the bracket type A3, this is the cell that contains the Text. Then comma. Then type the Old_text, which is “h.” Then comma. Then we will add the New_text, which is “s” because we want to substitute the” h” with “s.” We will add the Instance_ num, which specifies which location in the text we want to substitute the letter; the ‘h‘ is the first letter, we will input the Instance_ num as one. It should be like this: =SUBSTITUTE(A3,”h”,”s”,1)
Then press the Enter key to see results. There are two other methods to use the Substitute function.
Method one is to click fx on the top of the worksheet on the left. An Insert Function dialog box will appear, Inside the dialog box, in the Category section, click the drop-down arrow and select Text. Then select Substitute function.
A Function Arguments dialog will pop up.
Type A3 into the Text entry box.Type “h” into the Old_text entry box.Type “s” into the New _text entry box.Type “1” into the Instance_Num entry box.
Then press OK.
Method two is to go to the Formula tab and click Text in the Function Library group. In the Text drop-down list, click Substitute. A Function Arguments dialog box will appear. The process is explained in method one for the Function Arguments dialog box. Read: How to use the Find and FindB functions in Excel.
How to use the Replace function in Excel
Click the cell where you want to place the result. In this cell type =Replace; then bracket. Inside the bracket, input the cell where the Old_text is, which is A3. Then comma For the Start_num, we will enter the number Seven because this is the character number we want to replace. For the Num_chars, we will enter the number Three because this is how many characters we want to replace. For the New_text, we will enter “P” because this is the text we will replace the three characters with. It should look like this; =REPLACE(A3,7,3, “P”).
Press Enter, you will see results. There are two other methods to use the Replace function.
Method one is to go to fx at the top of the worksheet on the left. An Insert Function dialog box will appear. Inside the dialog box, in the Category section, click the drop-down arrow and select Text. Select Replace function.
A Function Arguments dialog will pop up.
Type A3 into the Old_text entry box.Type 7 into the Start_num entry box.Type 3 into the Num_chars entry box.Type “P” into the New_text entry box.
Then press OK.
Method two is to go to the Formula tab in the Function Library group; click Text. In the Text drop-down list, select Replace. A Function Arguments dialog box will appear. The process is explained in method one for the Function Arguments dialog box. I hope this helps; if you have questions, please comment below.