+ Reply to Thread
Results 1 to 4 of 4

Address splitting

  1. #1
    Registered User
    Join Date
    09-02-2004
    Posts
    2

    Address splitting

    Good Day All,

    I am having a battle splitting and address cell, that contains 4 parts as below

    92 Wayward Walk, Amberlain, Greytown, 1234

    and using the LEFT, MID & RIGHT commands, i can only seperate the first, second & third and the last components

    please help, help, help

    Gordon Jamieson

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    If you don't need a formula then use Data > Text to columns > delimiter > comma.

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517

    Couldn't find a neat way!

    If Your address is in A1 and the splits are in A3,A4,A5 and A6 then

    92 Wayward Walk, Amberlain, Greytown, 1234

    =LEFT(A1,FIND(",",A1))
    =TRIM(MID(A$1,(FIND(A3,A$1)+LEN(A3)),FIND(",",A$1,(FIND(A3,A$1)+LEN(A3)))-(FIND(A3,A$1)+LEN(A3))+1))
    =TRIM(MID(A$1,(FIND(A4,A$1)+LEN(A4)),FIND(",",A$1,(FIND(A4,A$1)+LEN(A4)))-(FIND(A4,A$1)+LEN(A4))+1))
    =RIGHT(A$1,LEN(A$1)-FIND(A5,A$1)-LEN(A5))

    This works, but is horrible. The probem is the find function gives you the start position of the string when what you want is the end position.

    Can anyone fiind a better way?

    Mark.

  4. #4
    Registered User
    Join Date
    09-02-2004
    Posts
    2

    Talking Address Splitting

    Thanks Guys,

    I cannot believe i did'nt even think of the first option , but WOW on the second.

    Thanks for your efforts and assistance, it was greatly appreciated, this is going to save a co-worker of mine about 6 hours of work

    Regards Gordon

+ 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