Find the last occurrence of a character in a string


/ Published in: Visual Basic
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. =RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1,"_","*",LEN(A1)-LEN(SUBSTITUTE(A1,"_","")))))
  2.  
  3. # This will find the last occurrence of "_" and print every thing after that.
  4.  
  5. #input = ACCT_NBR_V1
  6. #output = V1
  7.  
  8. #Note: this will not work correctly if the input string has "*" in it
  9. #in that case you need replace "*" in the formula with some thing that doesn't exist in your #string

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.