Remove data that preceeds a character

T

Ty

I have a a column of data that has 4 seperate hyphens in the text.
EX. abc-123-abc-123-BEGIN NEEDED DATA AND THIS DATA ALSO HAS HYPHENS I WANT
TO KEEP.

How can I remove all the data that preceeds the 4th and final hyphen and
keep the needed data. The # of characters in the preceeding data varies, so
the 4th hyphen ( from the left) is the only consistent measure I have.
 
M

Mike H

Try,
=RIGHT(A1,LEN(A1)-FIND("^^",SUBSTITUTE(A1,"-","^^",LEN(A1)-LEN(SUBSTITUTE(A1,"-","")))))

Mike
 
S

Sheeloo

Try
=RIGHT(A2,LEN(A2)-FIND("^",SUBSTITUTE(A2,"-","^",4)))

assuming your text does not contain the character "^". If it does then you
will have to replace it with a character which will not be there...
 
T

Ty

Mike,

Almost. This field has 4 hyphens in the beginning of the cell, followed by
the data I need and then followed by data with more hyphens that I also need.
This formula keeps only the data after the last hyphens.

Here's another example, maybe I didnt explain it well. (the items i want
removed are the abc-123's

abc-123-abc-123-KEEP THIS DATA AND KEEP THIS
DATA-CBA-321-CBA-321-CBA-321-KEEP THIS DATA AS WELL
 
M

Mike H

How can I remove all the data that preceeds the 4th and final hyphen

You explained yourself very well unfortunately the explanation had little to
do with what you actually wanted.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top