+ Reply to Thread
Results 1 to 6 of 6

Separating Numbers and Text with Spaces

  1. #1
    Registered User
    Join Date
    02-13-2009
    Location
    South Carolina, USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Separating Numbers and Text with Spaces

    I have been googling for a while and can't find something that will exactly fit my needs. I wish I had more experience with excel, then maybe I could write this myself...

    Basically what I want to do is take this kind of thing all from one column:

    COLA
    1 blah blue
    green
    13 black grey brown

    and put it into two columns, one with only the numbers, and the other with only the text.

    COLB
    1

    13

    COL C
    blah blue
    green
    black grey brown

    Also, I want to be able to then take that data from COL B and C and have it raw so that I can edit it easily by simply selecting row3 in COLB and change it from 13 to 4 (or whatever.)

    thank you in advance for the help.

    [EDIT] - I prefer a formula solution, but I can do VBA as well. Basically the most simple way of doing this.
    Last edited by hobbitchips; 02-13-2009 at 09:45 PM.

  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 and Text with Spaces

    The formula for column B is:

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

    And for column C:

    =RIGHT(A1,LEN(A1)-FIND(" ",A1))

    Just copy those down.
    _________________
    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
    02-13-2009
    Location
    South Carolina, USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    re: Separating Numbers and Text with Spaces

    Quote Originally Posted by JBeaucaire View Post
    The formula for column B is:

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

    And for column C:

    =RIGHT(A1,LEN(A1)-FIND(" ",A1))

    Just copy those down.
    Not quite. Your formula returns the first thing in COLB and second in COLC. I need it to be only the number (if there is one) in COLB and then all the rest of the text in COLC

    So

    COLA
    1 blue blue
    green
    13 black green blue

    would translate into:

    COLB
    1

    13

    COLC
    blue blue
    green
    black green blue

  4. #4
    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 and Text with Spaces

    Sorry, I missed that. Here you go:

    B:
    =IF(ISNUMBER(VALUE(LEFT(A1,1))),LEFT(A1,FIND(" ",A1)-1),"")

    C:
    =IF(ISNUMBER(VALUE(LEFT(A1,1))),RIGHT(A1,LEN(A1)-FIND(" ",A1)),A1)

  5. #5
    Chris Bode
    Guest

    Re: Separating Numbers and Text with Spaces

    1.Select cell B1 and paste following formula
    =IF(ISNUMBER(FIND(" ",A1,1)),LEFT(A1,FIND(" ",A1,1)-1),"")
    2.Select cell C1 and paste following formula
    =IF(ISNUMBER(FIND(" ",A1,1)),MID(A1,FIND(" ",A1,1)+1,LEN(A1)),A1)
    Now drag the cells down to apply the same formula to cells below as well.

    Hope this works

    Have a nice time

    Chris
    Last edited by VBA Noob; 02-15-2009 at 06:31 AM.

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Separating Numbers and Text with Spaces

    Hi

    If you will only have a single string of numeric characters in the cell (and without leading zeros) then you could use this:

    Column B (number portion)

    =IFERROR(LOOKUP(9.9E+307,--MID(A1,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A1&1234567890)),ROW(INDIRECT("1:"&LEN(A1))))),"")

    and on col C:

    =SUBSTITUTE(A1,B1,"")

    Richard
    Richard Schollar
    Microsoft MVP - Excel

+ 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