Thread: Removing text
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Removing text

=MID(B1,1,FIND("#",SUBSTITUTE(B1,"_","#",LEN(B1)-LEN(SUBSTITUTE(B1,"_",""))))-1)

data in B1

HTH

"pokdbz" wrote:

I have a variable and I need to remove everything after the last "_" in a
string including the "_".

Example
abc_def_ghi_jklmnop

Result: abc_def_ghi