How to find the nth occurrence of a character in a string in Excel ?

Assume that you have a text in cell A1 and you wish you to find the 2nd occurrence of a specified character and display the position of it.

How to find the nth occurrence of a character in a string in Excel ?

In this example , lets have the cell A1 containing the following string

This is a Developer Publish Blog.

You have been provided with the task to display the 2nd occurrence of the character e and display its position.

You can use the FIND formula to achieve it.

In the cell B1 , enter the formula

=FIND(“e”,A1,FIND(“e”,A1)+1)

Press enter key. This should display the position of the 2nd occurrence of the character e.

image

FIND(“e”,A1)+1 indicates that it is the 2nd occurrence that we are interested in. If you want to get the 3rd occurrence , you can increase the value from 1 to 2 (FIND(“e”,A1)+2).

Leave A Reply

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

You May Also Like

In this post, you’ll learn how to Find Blank cells in excel so that you can remove or delete the blank cells form...
In this article, you’ll learn what is a Gauge Chart in Microsoft Excel. Also, you will learn how to add...
Microsoft Excel provides a shortcut for the users to move columns in excel using two different ways – using Shift...