93245 - descr-ip24tion: Q-how do i only extract 93245?

  • Thread starter Thread starter ChrisV
  • Start date Start date
C

ChrisV

Hi,

I have a number and a description (which may at times also contain a number
as well as -) within a cell in excel separated by a - . How do i extract
only the number at the front as in the subject. Numbers are of varying
lengths.

Regards,

Chris
 
Assuming your data is in A1, use this to extract the number before the
hyphen:

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

Your example has a space before the hyphen, so TRIM will get rid of
that. Multiplying by 1 converts the result to a number, but you can
leave this off if you want it as a text value. Copy the formula down
as required.

Hope this helps.

Pete
 
If there is always a "-" (dash) after the number you could use

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

That will give you a text string.
If you want a numeric string then

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

Tyro
 
Go To

Data-->Text-to-Columns

Select Delimited, press next

Then click the checkbox Other: and type in -

Then press finish
 
Before you press Finish, select the columns you don't want and "Do not import
column - skip"


Gord Dibben MS Excel MVP
 

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

Back
Top