Skip to main content

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:

=FIND(CHAR(160),SUBSTITUTE(text,char,CHAR(160),N))
  • 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:

=FIND(CHAR(160),SUBSTITUTE(A2,B2,CHAR(160),C2))

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.
  • SUBSTITUTE:
  • 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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations