+ Reply to Thread
Results 1 to 7 of 7

Excel 2007 : How to split text, number and a letter into 3 columns?

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2007
    Posts
    3

    How to split text, number and a letter into 3 columns?

    I have read every single thread in internet and this forum and haven't found any answer to this question.
    I have a large list of companies with their addresses, for example:

    High Mountain 3
    Little Italy 445
    West Virgina 23 a

    I would like to split them apart to get every part of the address into 3 columns (West Virginia / 23 / a). The problem is that I can't use functions LEFT, RIGHT or MID because the length of the words is different.

    Thanks for your solutions!
    Last edited by Tofsy; 03-21-2012 at 05:45 AM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: How to split tex, number and a letter into 3 columns?

    Hi,

    Try this:

    Data > Text to columns > Delimited > Space > Finish
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    03-20-2012
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to split tex, number and a letter into 3 columns?

    Hi, i forgot to say that I have already tried it, but the problem is that some addresses have more words (example: Northington or Little Italy). I would like to have 3 columns: Address, number, additional letter. In your case I get everything messed up.

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How to split tex, number and a letter into 3 columns?

    Hi

    Wuth your addresses in Column A, in B1, put this formula

    =LEFT(A1;FIND(" ";A1;FIND(" ";A1;1)+1)-1)

    In C1 the Array formula(Ctr+Shift+Enter)

    =SUM((MID(0&A1;LARGE(IF(ISNUMBER(MID(0&A1;ROW($1:$256);1)*1);ROW($1:$256);1);ROW($1:$256));1)*1)*10^(ROW($1:$256)-1))

    In D1, this also Array Formula

    =TRIM(MID(A1;MAX(ISNUMBER(MID(A1;COLUMN(1:1);1)*1)*COLUMN(1:1))+1;2^15))

    Copy down.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  5. #5
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: How to split tex, number and a letter into 3 columns?

    Without array formula you could do this:

    In B1:

    =LEFT(A1;LEN(A1)-IF(AND(C1<>"";D1<>"");LEN(C1)+LEN(D1)+2;IF(OR(C1<>"";D1<>"");LEN(C1)+LEN(D1)+1;A1)))

    In C1:

    =IF(ISNUMBER(MID(A1;FIND("@";SUBSTITUTE(A1;" ";"@";LEN(A1)-LEN(SUBSTITUTE(A1;" ";""))))+1;256)*1);MID(A1;FIND("@";SUBSTITUTE(A1;" ";"@";LEN(A1)-LEN(SUBSTITUTE(A1;" ";""))))+1;256)*1;MID(A1;FIND("@";SUBSTITUTE(LEFT(A1;LEN(A1)-LEN(D1)-1);" ";"@";LEN(LEFT(A1;LEN(A1)-LEN(D1)-1))-LEN(SUBSTITUTE(LEFT(A1;LEN(A1)-LEN(D1)-1);" ";""))));LEN(A1)-FIND("@";SUBSTITUTE(LEFT(A1;LEN(A1)-LEN(D1)-1);" ";"@";LEN(LEFT(A1;LEN(A1)-LEN(D1)-1))-LEN(SUBSTITUTE(LEFT(A1;LEN(A1)-LEN(D1)-1);" ";""))))-LEN(D1)*1)*1)

    In D1:

    =IF(ISNUMBER(MID(A1;FIND("@";SUBSTITUTE(A1;" ";"@";LEN(A1)-LEN(SUBSTITUTE(A1;" ";""))))+1;256)*1);"";MID(A1;FIND("@";SUBSTITUTE(A1;" ";"@";LEN(A1)-LEN(SUBSTITUTE(A1;" ";""))))+1;256))

    Copy down

    The above only works if there is only 1 letter in the end of the address. It should work no matter how many words are in the streetname.
    Last edited by Søren Larsen; 03-20-2012 at 10:14 AM.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  6. #6
    Registered User
    Join Date
    03-20-2012
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to split tex, number and a letter into 3 columns?

    Guys thank you very much!

    @Fotis1991: Your function doesn't seem to work because it could work only with streets, that contain 2 words. Beside that, i always get 0 instead of number of the street.

    @Søren Larsen: Your function works perfectly! As you said it works only with addresses, that have a or b in the end and it doesn't work if they have a b in the end (it works with a/b though!). In that case I can go through manually and just correct the A column instantly!

    Thanks again for your effort, I got my answer.

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How to split text, number and a letter into 3 columns?

    Hi

    Nice that you found your solution. But it's different when a formula is better than another and different that to say that doesn't works..

    @Fotis1991: Your function doesn't seem to work because it could work only with streets, that contain 2 words. Beside that, i always get 0 instead of number of the street.
    1) Yes, first formula, is for 2 words only(as your example)

    2) Formula with the numbers, i think works ok
    Attached Files Attached Files

+ 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