+ Reply to Thread
Results 1 to 8 of 8

split data into 2 cells, text to columns

  1. #1
    Registered User
    Join Date
    02-26-2009
    Location
    Columbus, OH
    MS-Off Ver
    2007
    Posts
    3

    split data into 2 cells, text to columns

    i have cells with city and state in them and i'm trying to separate the one column into two columns. the problem is, i'm trying to keep the city name in one column and the state in the other. some of my cells have two word cities like new albany, or upper arlington. the text to columns feature is separating those cells into 3 columns not 2. is there a way to do this?

    example:
    worthington, oh
    upper arlington, oh

    text to columns splitting upper arlington into 3 different cells because the only delimiter in the cell is a space. i need to keep upper arlington in one cell and oh in another. thanks for any help
    Last edited by ericc2728; 02-26-2009 at 03:15 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: split data into 2 cells, text to columns

    Is the comma in those cells?.. that can be used to delimit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Valued Forum Contributor Dunc3142's Avatar
    Join Date
    09-05-2007
    Location
    Franklin OH
    MS-Off Ver
    2000 and 2007 and 2010 @ Home & Teach 2010
    Posts
    351

    Re: split data into 2 cells, text to columns

    Try this it is assuming that there is a comma.
    Attached Files Attached Files
    Yes it will. we just have to figure out how...
    If I have helped you, PLEASE click the * and add to my Rep.
    Also, if the problem is SOLVED please mark it as so.

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: split data into 2 cells, text to columns

    This macro will split the selected text by the final space.

    Please Login or Register  to view this content.
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007.
    Martin

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: split data into 2 cells, text to columns

    If there are no commas... 2 formulas...

    in B1:

    =LEFT(A1,FIND("^^",SUBSTITUTE(A1," ","^^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-1)

    in C1:

    =TRIM(SUBSTITUTE(A1,B1,""))

    both copied down.

  6. #6
    Registered User
    Join Date
    02-26-2009
    Location
    Columbus, OH
    MS-Off Ver
    2007
    Posts
    3

    Re: split data into 2 cells, text to columns

    no commas, only space. i'll try some of your suggestions for a space

  7. #7
    Registered User
    Join Date
    02-26-2009
    Location
    Columbus, OH
    MS-Off Ver
    2007
    Posts
    3

    Re: split data into 2 cells, text to columns

    NBVC you are awesome, that was the exact formula i was looking for!
    mrice - i tried your macro and for some reason it is carrying part of the city name over to the next cell. the format looks like this after running the macro

    Column A Column B
    Powell ell OH
    Pickerington kerington OH
    Williamston liamston MI
    Johnstown nstown OH
    Columbus umbus OH
    Bellbrook lbrook OH
    Columbus umbus OH
    Anchorage horage AK
    Dublin lin OH
    Sylvania vania OH
    New OH
    Grove ty OH
    Upper on OH
    Westerville terville OH
    Last edited by NBVC; 02-26-2009 at 03:03 PM. Reason: Fixed spelling of my name

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: split data into 2 cells, text to columns

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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