Note: The other languages of the website are Google-translated. Back to English
English English

Find nth occurrence of character in a cell

If you need to find and get the position of nth occurrence of a specific character from a text string as below screenshot shown, there is no direct function for you to solve this task in Excel. This article, I will talk about using a formula which combines the FIND and SUBSTITUTE functions to deal with it.

Find the position of nth occurrence of a specific character in a cell

For example, I have a list of text strings in column A, and now, I want to get the position of the specific characters in column B which appears the nth occurrences, how to solve it?

In Excel, you can combine the FIND and SUBSTITUTE functions for solving this job, the generic syntax is:

  • text: The text string or cell value that you want to use.
  • N: The nth occurrence of a character that you want to get position.

1. Please enter or copy the below formula into a blank cell where you want to put the result:


Note: In the above formula, A2 is the cell contains the text string that you want to use, B2 is the specific character that you want to find, and C2 is the nth number that you want to get the position of the specific character based on.

2. And then, drag the fill handle down to the cells that you want to apply this formula, and you will get the result as you need:

Explanation of the formula:

SUBSTITUTE(A2,B2,CHAR(160),C2): The SUBSTITUTE function will replace the 3rd occurrence of the character “o” with the char(160) character. It returns the text string as following screenshot shown:

FIND(CHAR(160),SUBSTITUTE(A2,B2,CHAR(160),C2)): This FIND function is used to look for the position of the char(160) character within the new text string returned by the SUBSTITUTE function.

Relative functions used:

  • FIND:
  • The FIND function is used to find a string within another string, and returns the starting position of the string inside another one.
  • The SUBSTITUTE function replaces text or characters within a text string with another text or characters.

More articles:

  • Extract Nth Word From Text String In Excel
  • If you have a list of text strings or sentences, now, you want to extract the specific nth word from the list as below screenshot shown. This article, I will introduce some methods for solving this job in Excel.
  • Extract Last Line Of Text From A Multi-Line Cell
  • To extract the last line of text from a text string which is separated by line breaks, normally, there is no direct way for you to solve this. This article, I will introduce a formula to deal with this task in Excel.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations