Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • CHOOSE function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel ROWS Function
  • How to get address of last cell in range in Excel
  • Extract all partial matches in Excel
  • How to get last column number in range in Excel

Data Analysis Examples

  • How to count table rows in Excel
  • How to create Checklist in Excel
  • Understanding Anova in Excel
  • Use Data Form to input, edit and delete records in Excel
  • Everything about Charts in Excel

Data Validation Examples

  • Excel Data validation require unique number
  • Excel Data validation exists in list
  • Excel Data validation date in next 30 days
  • Excel Data validation specific characters only
  • Excel Data validation date in specific year

Get position of 2nd 3rd and more instance of character in Excel

by

To get the position of the 2nd, 3rd, 4th, etc. instance of a specific character inside a text string, you can use the FIND and SUBSTITUTE functions.

Note: we use “~” in this case only because it rarely occurs in other text. You can use any character that you know won’t appear in the text.

Worked Example:   How to extract last two words from text string in Excel

Formula

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

Explanation

In the example shown, the formula in E4 is:

=FIND("~",SUBSTITUTE(B4,"x","~",D4))

How this formula works

At the core, this formula uses the fact that the SUBSTITUTE function understands “instance”, supplied as an optional forth argument called “instance_num”. This means you can use the SUBSTITUTE function to replace a specific instance of a character in a text string.  So:

SUBSTITUTE(B4,"x","~",D4)

replaces only the 2nd instance (2 comes from D4) of “x” in text in B4, with “~” character. The result looks like this:

Worked Example:   How to calculate Number of Instances in Excel

100×15~50

Worked Example:   Count Number of Words in Excel

Next, FIND locates the “~” inside this string and returns the position, which is 7 in this case.

Post navigation

Previous Post:

How to pad text to match equal length in Excel

Next Post:

Normalize text by removing punctuations, extra spaces and more in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • How to count specific words in a range in Excel
  • Get position of 2nd 3rd and more instance of character in Excel
  • Remove first character in a cell in Excel
  • How to pad text to match equal length in Excel
  • How to find nth occurrence of character in Excel
  • Display Days in month in Excel
  • How to join date and text together in Excel
  • How to get Holiday Date from Year in Excel
  • Two ways to sum time over 30 minutes in Excel
  • How to calculate Next working/business day in Excel
  • IRR function: Description, Usage, Syntax, Examples and Explanation
  • CUMIPMT function: Description, Usage, Syntax, Examples and Explanation
  • How to calculate principal for given period in Excel
  • Future value vs. Present value examples in Excel
  • How to Calculate Tax Rates in Excel
Acronyms, Abbreviations, Initialism & What They Stand For
© 2021 xlsoffice. All Rights Reserved | Teal Smiles