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

Check for typing errors: it worked fine for me.

"pokdbz" wrote:

On the last substitue its giving an error: Function or Sub not defined.

"JE McGimpsey" wrote:

One way:

=LEFT(A1, FIND("^", SUBSTITUTE(A1, "_", "^", LEN(A1) -
LEN(SUBSTITUTE(A1, "_", "")))) - 1)

In article ,
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