Stripping nubers from text in a cell

D

Dan S

I have a bunch of cell with varying lench that have numbers at the beginning
(also of varying length. Ex:

1258 ahjKJ yuUIOI
45687045HJKoiuwER

I just want to extract the text from these cell. How do I do that?

Thanks,
Dan
 
R

Rick Rothstein \(MVP - VB\)

Assuming your text is not longer than 999 characters and that your digits
are all next to each other (no leading or intervening spaces or
characters)...

=MID(A1,SUMPRODUCT(--ISNUMBER(--MID(A1,ROW($1:$999),1)))+1,999)

Rick
 
R

Ron Coderre

With

A1: (containing text that may begin with numbers.....eg 1258 ahjKJ yuUIOI)

This formula (in sections to compensate for text wrap)
returns the text to the right of those beginning numbers:
B1: =MID(A1,MATCH(FALSE,INDEX(ISNUMBER(--LEFT(A1,ROW(INDEX($A:$A,1):
INDEX($A:$A,LEN(A1))))),0),0),LEN(A1))

In the above example, B1 returns: ahjKJ yuUIOI

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 
T

T. Valko

*Maybe* this:

Assuming the number is *always* at the beginning of the string and that
there are no other numbers in the string.

=TRIM(MID(A1,SUM(LEN(A1)-LEN(SUBSTITUTE(A1,{0,1,2,3,4,5,6,7,8,9},"")))+1,255))
 
R

Ron Coderre

Certainly better than what I threw together.
(I don't know WHAT I was thinking.)

Ron
 
R

Ron Coderre

Maybe this (If no other numbers will be embedded within the text):

=MID(A1,COUNT(INDEX(--MID(A1,ROW($1:$255),1),0))+1,LEN(A1))

or...if you need to remove leading/trailing spaces:
=TRIM(MID(A1,COUNT(INDEX(--MID(A1,ROW($1:$255),1),0))+1,LEN(A1)))

But, if there may be numbers in the text...the hideous formula I posted
earlier will do what you asked for.

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 
R

Ron Rosenfeld

=MID(A1,SUMPRODUCT(--ISNUMBER(--MID(A1,ROW($1:$999),1)))+1,999)

Slightly shorter <vbg>

=MID(A1,SUMPRODUCT(--ISNUMBER(-MID(A1,ROW($1:$999),1)))+1,999)
--ron
 
D

Dan S

I think that might do the trick...I wish there was something a little
simplier (built in the Excel) but I appreciate the help!

Dan
 
R

Rick Rothstein \(MVP - VB\)

Certainly better than what I threw together.
(I don't know WHAT I was thinking.)

LOL... trust me, I know the feeling. As a matter-of-fact, I just did the
same type of thing down a few threads in identifying the first Monday in a
month. Fortunately for the OP, Ron Rosenfeld posted a saner formula to use.

Rick
 
R

Rick Rothstein \(MVP - VB\)

I wasn't sure what to do about that. The OP said he wanted to extract the
text (non-numbers) and that leading space is text, so I left it in.

Rick
 
R

Ron Coderre

Well, I'm just glad I could help.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 

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