Find the last occurrence of a character in a string

Submitted by:Andery Smith

Date added:09 April, 2011

Category:Visual Basic

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

Tags: string , character

Code Snippet:

    =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
 
 

Comments