SOLVED

Search for the position of the last occurrence of a specific character in a text

Copper Contributor

I have to search for the position of the last occurrence of a specific character in a text.

For example, in the below text I want to know the position of the last occurrence of character "/"

abc.com/Computers/Laptops/INDT123L34

Which formulas can be used to accomplish this?

2 Replies
best response confirmed by mtarler (Silver Contributor)
Solution

@VaibsP Here are 2 options:

using Excel365:

=LEN(TEXTBEFORE(A1,"/",-1))+1

older version:

=LEN(A1)-LEN(TRIM(MID(SUBSTITUTE(A1,"/",REPT(" ",LEN(A1))),(LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))*LEN(A1),LEN(A1))))

 

 

 

@mtarler Thanks for the quick response. Its working.

1 best response

Accepted Solutions
best response confirmed by mtarler (Silver Contributor)
Solution

@VaibsP Here are 2 options:

using Excel365:

=LEN(TEXTBEFORE(A1,"/",-1))+1

older version:

=LEN(A1)-LEN(TRIM(MID(SUBSTITUTE(A1,"/",REPT(" ",LEN(A1))),(LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))*LEN(A1),LEN(A1))))

 

 

 

View solution in original post