Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Formula - Delete after last occurrence of delimiter 1

Status
Not open for further replies.

Moebius01

Programmer
Joined
Oct 27, 2000
Messages
309
Location
US
Hoping this is the right forum for this question.

I'm trying to come up with a formula to delete all characters after the last occurrence of a delimiter, but I keep getting stuck. I have something to work with text after a delimiter, but ran into a problem when the string contained in more than once.

If cell A1 contains "Corp-Acct-NYC" I need to return "Corp-Acct".

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

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top