Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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.

Replace nth/all occurrences of a character in string in Excel

Enable you to do smarter, faster and better

Kutools - the best office productivity tool brings 300 advanced features to Excel. Details... Download...

Office Tab - brings tabbed interface to Excel and Word, make your work much easier. Details...Download...



Replace nth/all occurrences of a character in string in Excel

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:

Notes:
(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","_").


Related articles:



Excel Productivity Tools

Kutools for Excel - The Best Office Productivity Tool

  • Brings 300 powerful advanced features to Excel, enable you to do smarter, faster and better.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Office Tab - brings tabbed interface to Office, make your work much easier.

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Turker TUNALI · 9 months ago
    I use Office 2013 and last parameter doesn't work as intended. I didn't specify it but it works like 1 entered.Only first occurence is replaced.
    • To post as a guest, your comment is unpublished.
      kellytte · 6 months ago
      Hi Turker,
      To replace all of a certain character from a cell, you need to apply this formula =SUBSTITUTE(A1,"o","_")