Skip to main content

Excel Formula: Find position of nth occurrence of a character

To find the first occurrence of a character in a string in Excel, you can use the FIND function. However, how to find the position of the second or third or nth occurrence of a specific character in a string? Here this tutorial introduces a formula which combines the FIND and SUBSTITUTE functions to handle this task and explains the arguments of the formula.
doc find position of nth occurrence of a character 1

Generic formula:

=FIND("~",SUBSTITUTE(text,char,"~",nth_occurrence))

Arguments

Text:the text or cell refence in which you want to find character.
Char:the character you want to find its position.
Nth_occurrence:the specified occurrence of the character.

Return value

This formula returns a number which indicates the position of the nth occurrence of a character.

How this formula work

Here, in cell E3, you need to find the position of the second occurrence of the character in cell C2 in the text string in cell B3. Please use below formula:

=FIND("~",SUBSTITUTE(B3,C3,"~",D3))

Press Enter keys to get the position, and you can drag fill handle over the adjacent cells to apply this formula.
doc find position of nth occurrence of a character 2

Explanation

SUBSTITUTE(B3,C3,"~",D3): the SUBSTITUTE function replaces the old text with a new one in a specified instance. Here this formula replaces the character in cell C3 (+) with the new character “~” in the text string of cell B3 (Shift+Ctrl+Enter), and returns Shift+Ctrl~Enter.

FIND function: the FIND function returns the position of a character. Here the formula returns the position of character “~” in the new text string “Shift+Ctrl~Enter”.

Remark

“~” only indicates a new character which is used to replace the character you want to find, and you can change it to others. But take notice, it must be the character does not exist in the string.

Sample File

doc sampleClick to download sample file


Relative Formulas

  • Find most requenst text with criteria
    In some cases, you may want to find the text which appears most frequently based on a criterion in Excel. This tutorial introduces an array formula to handle this job and gives the explanation about the arguments of this formula.
  • Combine cells with commas
    Here this tutorial provides some formulas to join multiple cells into one cell with comma as separator as below screenshot shown, and also explains how the formulas work in Excel.
  • Make text same length
    If there is a list of texts with different lengths, for looking nicer, you can make these text with same length by adding trailing characters as below screenshot shown. Here it provides a formula which combines the LEN and REPT functions to handle it in Excel.
  • Check if cell contains number
    Sometimes, you may want to check if a cell contains numeric characters. This tutorial provides a formula which will return TRUE if the cell contains number, FALSE if cell does not contain number.

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