+ Reply to Thread
Results 1 to 7 of 7

Extracting numbers from text

Hybrid View

  1. #1
    Registered User
    Join Date
    02-09-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    49

    Extracting numbers from text

    See attached file for example.
    I need to separate text information from a cell into 3 columns (W,9-8). The first letter I know how to extract. The problem is to extract the number in the middle (1 or 2 digit) between "," and "-" and also the last number. For the last number I could use right() function but the problem is that number could be 1 or 2 digits so I can not specify in advance so formula would have to extract the last number till "-". Anyone knows how to do this?
    Attached Files Attached Files
    Last edited by bmind; 06-15-2009 at 12:00 AM.

  2. #2
    Forum Contributor vandanavai's Avatar
    Join Date
    09-04-2006
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    256

    Re: Extracting numbers from text

    Hello

    i think u can use Delimit.
    Try Following
    1. Assuming data to be separated is in A1:A4
    2. Select range A1:A4
    3. Go to option 'Data' -> 'Text to Column'
    4. 'Delimited' -> next
    5. select 'Delimiters' as 'Other' and put - in delimiter box
    6. next
    7. select destination cell as B1
    8. Then finish
    9. now insert one column between column B and C
    10.Select Range B1:B4
    11 Go to option 'Data' -> 'Text to Column'
    12. 'Delimited' -> next
    13. select 'Delimiters' as 'Comma'
    14. next
    15. select destination cell as B1
    16. Then finish

    I think this will give u desired result.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extracting numbers from text

    Formula approach...

    E3 and copied down:
    =SUBSTITUTE(MID(C3,FIND(",",C3)+1,2),"-","")

    F3 and copied down:
    =RIGHT(C3,LEN(C3)-FIND("-",C3))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Extracting numbers from text

    Hi,

    If you use the formula approach suggested by JBeaucaire this extracts the numbers as text, if you should require these to be avtual numbers you could use

    =SUBSTITUTE(MID(C3,FIND(",",C3)+1,2),"-","")*1

    or

    =VALUE(SUBSTITUTE(MID(C3,FIND(",",C3)+1,2),"-",""))
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  5. #5
    Registered User
    Join Date
    02-09-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Extracting numbers from text

    Thanks vandanavai for your effort.
    JBeaucaire and oldchippy: Formulas work perfectly.
    Much appreciated.

  6. #6
    Registered User
    Join Date
    02-23-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Extracting numbers from text

    The format of the text in which I need to extract numbers is as follows:

    23411268 - 23411270

    Need to extract the following:

    23411268
    23411269
    23411270

    These numbers have to be listed in three seperate rows.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extracting numbers from text

    Hi Greg, welcome to the forum.

    Be sure to read through the Forum Rules so you can use and follow them effectively. For instance, rule #2 states that you should start your own thread for your own questions, do not take over someone else's thread with your own topic.

    Posting a new thread also insures you get the most attention, anyway. New threads always do.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1