Return to Snippet

Revision: 38285
at December 30, 2010 03:59 by mprabhuram


Initial Code
=RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1,"_","*",LEN(A1)-LEN(SUBSTITUTE(A1,"_","")))))

# This will find the last occurrence of "_" and print every thing after that.

#input = ACCT_NBR_V1
#output = V1

#Note: this will not work correctly if the input string has "*" in it 
#in that case you need replace "*" in the formula with some thing that doesn't exist in your #string

Initial URL
http://www.excelforum.com/excel-general/601021-find-the-last-occurrence-of-a-character-in-a-string.html

Initial Description
I would like to find the position of the last occurrence of a character in a string and print every thing after that.

Initial Title
Find the last occurrence of a character in a string

Initial Tags

                                

Initial Language
Visual Basic