Extracting (Copying) Text to the Right of a Hyphen

  • Thread starter ConfusedNHouston
  • Start date
C

ConfusedNHouston

In this case it's a hypen but I assume it could be any symbol or letter. I
have text in column A in the following formats:

TEXT-01
TEXT-0004
TEXTTEXT-20
TEXTANDTEXT-1000

I want to get everything after the hyphen into column B

So column B would look like

-01
-0004
-20
-1000

I dont' really care if the hyphen is extracted or not. I'd like to know how
to do this both with and without extracting the hyphen. If possible.

Thanks
 
T

T. Valko

To extract with the hyphen:

=MID(A1,FIND("-",A1),255)

To extract without the hyphen:

=MID(A1,FIND("-",A1)+1,255)
 
P

Peo Sjoblom

=MID(A1,FIND("-",A1),255)

assuming there are no other hyphens earlier in the text string



--


Regards,


Peo Sjoblom
 
C

Chip Pearson

You can use a formula like

=MID(A1,FIND("-",A1),LEN(A1))

To make the "-" character a variable, put that character in some cell, say
C1, and use

=MID(A1,FIND(C1,A1),LEN(A1))

If the character isn't found, you'll get a #VALUE error.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

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