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

Lookup and Reference Examples

  • How to reference named range different sheet in Excel
  • Create hyperlink with VLOOKUP in Excel
  • How to use Excel ROWS Function
  • Perform case-sensitive Lookup in Excel
  • How to use Excel INDIRECT Function

Data Analysis Examples

  • How to create a Histogram in Excel
  • How To Create Frequency Distribution in Excel
  • Number and Text Filters Examples in Excel
  • How to perform a t-Test in Excel
  • Remove Duplicates Example in Excel

Data Validation Examples

  • Data validation must not exist in list
  • Excel Data validation unique values only
  • Excel Data validation no punctuation
  • Excel Data validation whole percentage only
  • Excel Data validation don’t exceed total

How to find nth occurrence of character in Excel

by

To find the nth occurrence of a character in a text string, you can use a formula based on the FIND and SUBSTITUTE functions.

Formula

=FIND(CHAR(160),SUBSTITUTE
(text,"@",CHAR(160),N))

Explanation

In the example shown, the formula in D5 is:

=FIND(CHAR(160),SUBSTITUTE
(B5,"@",CHAR(160),C5))

How this formula works

In this example we are looking for the nth occurrence of the “@” character.

Worked Example:   How to find and replace multiple values at same time in Excel

Working from the inside out, we first use the SUBSTITUTE function to replace the nth occurrence of “@” with CHAR(160):

SUBSTITUTE(B5,"@",CHAR(160),C5)

The SUBSTITUTE function has an optional 4th argument called instance number that can be used to specify the instance that should be replaced. This number comes from column C.

Worked Example:   Remove leading and trailing spaces from text in one or more cells in Excel

SUBSTITUTE then replaces the nth occurrence of “@” with CHAR(160), which resolves to “†”. We use CHAR(160) because it won’t normally appear in text. You can use any character you know won’t exist in the text.

Worked Example:   How to split text with delimiter in Excel

Finally, the FIND character looks for CHAR(160) and returns the position.

Post navigation

Previous Post:

How to count specific words in a cell in Excel

Next Post:

How to count number of characters of text in a cell 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
  • REPT function: Description, Usage, Syntax, Examples and Explanation
  • How to Separate Text Strings in Excel
  • How to display conditional message with REPT function in Excel
  • Count Number of Words in Excel
  • CLEAN function: Description, Usage, Syntax, Examples and Explanation
  • Get first day of month in Excel
  • Convert decimal hours to Excel time
  • Calculate time difference in hours as decimal value in Excel
  • Count day of week between dates in Excel
  • Calculate expiration date in Excel
  • XIRR function: Description, Usage, Syntax, Examples and Explanation
  • How to calculate present value of annuity in excel
  • MDURATION function: Description, Usage, Syntax, Examples and Explanation
  • ODDLYIELD function: Description, Usage, Syntax, Examples and Explanation
  • Bond valuation example in Excel
Acronyms, Abbreviations, Initialism & What They Stand For
© 2022 xlsoffice . All Right Reserved. | Teal Smiles