+ Reply to Thread
Results 1 to 5 of 5

Separating numbers from text

  1. #1
    Registered User
    Join Date
    09-09-2011
    Location
    NJ
    MS-Off Ver
    Excel 2007
    Posts
    3

    Separating numbers from text

    I need some help separating numbers from text in a data string

    here is the general format of the data string

    ##.##% ABC; ABC ##, ABC ## (##-## A)

    1) the numbers after the second and third ABC as well as the numbers in the parentheses can be single digits such as ABC #, ABC # (#-# A) or any combination of double and single digits
    2) the second and third ABC can be of various lengths and can also contain multiple words such as:

    ABC
    ABCD
    ABCDEF ABC ABCDEF
    etc

    I used the text to columns function to separate the string into three cells

    A1
    ##.## ABC

    B1
    ABC ##

    C1

    ABC ## (##-## A)

    I used the LEFT function to get ##.## into one cell

    I used =SUBSTITUTE(B1," ","|",LEN(B1)-LEN(SUBSTITUTE(B1," ",""))) to get ABC|## into a cell and then used the text to columns function again to get ABC into one cell and then ## into another...

    I am struggling on separating the last cell which contains ABC ## (##-## A)...I need to get ABC into one call, ## into another cell, the first number in the parentheses into one cell and the second number in the parentheses into another cell

    please help

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

    Re: Separating numbers from text (again!)

    Highlight the last column and use REPLACE (Ctrl-H) to search for ( and replace with nothing, repeat for ).

    Then use another text to columns to split out the data, split on both spaces and dashes.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    09-09-2011
    Location
    NJ
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Separating numbers from text

    well that gets the format into ABC ABCD # #-# A

    but if I use the text to column function, it puts ABC into one cell and ABCD into another cell, when I need them in the same one...and I used the substitue formula rather then replace because I would have to update the replace field each column first with ( and then with )...I would rather do that in a formula...so it didn't work completely, but got me a little closer...

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Separating numbers from text

    maybe this
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    09-09-2011
    Location
    NJ
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Separating numbers from text

    holy crap...you walk on water in my eyes....sweet....works perfectly....

+ 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