Posted By

mprabhuram on 12/30/10


Tagged

excelformula


Versions (?)

Find the last occurrence of a character in a string


 / Published in: Visual Basic
 

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

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

  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

Report this snippet  

You need to login to post a comment.