Parsing a cell's value

B

Bob Zimski

I have a cell which contains a part number and a revision level in the format
'ARD010 Rev: 2'. I need to drop the 'Rev: 2' portion in the cell to the
right and the existing cell needs to end up with 'ARD010' without any spaces.

Any help appreciated.

Bob
 
B

Bob Zimski

I forgot to mention that the part number can vary in length which is what is
causing me trouble.
 
S

Sam Wilson

You could use text to columns - Highlight the column and go to data/text to
columns.

From there choose delimited, and specify (space) as your delimiter from the
second screen, making sure you tick "treat consecutive delimiters as one"
 
J

JoeU2004

Bob Zimski said:
I need to drop the 'Rev: 2' portion in the cell to the right and the
existing cell needs to end up with 'ARD010' without any spaces.

Ostensibly, try:

=left(A1,find(" ",A1)-1)

That assumes there are no spaces __before__ the part number. Alternatively:

=trim(left(A!,find(" ",A1)-1))

Both assume that the white space between part number and revision are true
blanks. If the above formula does not work, post back here to solve the
problem.


------ original message -----
 
B

brzak

if the contents are always in the same format, i.e. a combination of
letters and numbers only, followed by spaces, folowed by 'Rev #', then
a formula would suffice

If cell A1 contents are (no quotes): 'ARD010 Rev: 2'

you could use the formula:

=LEFT(A1,FIND(" ",A1)-1)

resulting in

'ARD010'

brz
 
P

Patrick Molloy

if there are spaces before then the formula should be

=left( TRIM(A1) ,find(" ",TRIM(A1) )-1)
 
R

Rick Rothstein

Assuming the revision level always starts with "Rev:" (in that letter
casing), you could do this...

=TRIM(LEFT(A1,FIND("Rev:",A1&"Rev:")-1))

If the "Rev" is not always in that letter casing (that is, maybe sometimes
it is "rev"), the replace FIND with SEARCH.
 

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