How to replace nth/all occurrences of a character in string in Excel?
For example, there is a string in a cell, and you need to replace the third “o” in the string, how could you quickly solve it? And what if replacing all occurrence of this characters in the string? This article will show you the method.
Enable you to do smarter, faster and better
This method will introduce the easy SUBSTITUTE function to replace the nth or all occurrences of a certain character in a cell in Excel.
Select a blank cell, and type the formula =SUBSTITUTE(A1,"o","_",3) into it, and press the Enter key. See screenshot:
And now you will see the third “o” is replaced. See screenshot:
(1) In the formula =SUBSTITUTE(A1,"o","_",3), A1 is the cell you will replace string, o is the specified character you will replace, _ is the specified character you will replace with, and 3 means you will replace the 3rd occurrence of “o”.
(2) If you need to replace all occurrences of “o” with underline in the Cell A1, please apply this formula =SUBSTITUTE(A1,"o","_").