Advanced Parse - separate address from suburb in two cells

Smoke

New Member
Joined
Feb 11, 2004
Messages
4
Hello everyone,

i have a large list of cells with data in the format below:
123 BLACKBURN ROAD GLEN WAVERLEY
6 CAROL STREET SCORESBY
345 KIERS AVENUE MOUNT WAVERLEY
4 & 5 / 23 BLACKWOOD DRIVE HAMPTON PARK
34 HUNTINGDALE ROAD MOUNT WAVERLEY
234 CASSINIA AVENUE ASHWOOD
213 Springvale Rd. Springvale
232 Tucker St. Ormond

my aim is to automatically separate the suburb from the street address,example:
split 123 BLACKBURN ROAD and GLEN WAVERLEY into two cells
(address) |||||||||||||||||||||||||||||||||||||||(suburb)
6 CAROL STREET ||||||||||||||||||||||||||||||SCORESBY
345 KIERS AVENUE||||||||||||||||||||||||||||MOUNT WAVERLEY
4 & 5 / 23 BLACKWOOD DRIVE||||||||||||||||||||||||HAMPTON PARK
213 Springvale Rd. ||||||||||||||||||||||||||||Springvale
232 Tucker St. |||||||||||||||||||||||||||||||||Ormond

I have tried using the Text-to-Column wizard, but the allowed delimiter is only 1 character. The only possible way i see it is to search each cell for a delimiter(from a list of many delimiter options) and split it into two cells, with the delimiters being every possible "STREET" "St." "ROAD" "DRIVE" "Rd." etc. That way everything after a "STREET" will be regarded as a suburb and it will be separated.

Notes: suburbs can be with 1, 2 or 3 words, streets can have 2 or more words in them
i have a column of the suburbs if that helps.
It might be an idea to convert all to uppercase or each first word with upper case.
I am using MSExcel 2000, but can try using the newest.
(Sorry i didn't make this pretty i don't know how.)
 
Re: Advanced Parse - separate address from suburb in two cel

oops 2 posts b4 I had the chance to post. Oh well, you have another option then Smoke. :LOL:
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Re: Advanced Parse - separate address from suburb in two cel

Thank you Parry i found your solution working perfectly and easy enough for me to implement :biggrin:
thanks for your time.
 
Upvote 0
Re: Advanced Parse - separate address from suburb in two cel

Your most welcome. I like Dans option too.

btw, the 2nd argument is not case sensitive so you can enter your criteria as ROAD or road and they should both work OK.

Spot ya. :biggrin:
 
Upvote 0
Hi Smoke,

A fellow Victorian? :)

The code below is a little more complex than what your example called for but it tests the addresses for validity as it extracts.

If you select your list then run the macro it parses the address into the two columns to the immediate right

It looks for
(first character number)(space...Text String)(space....Street Type)(Remaining text)
If the string doesn't meet the criteria it puts an "invalid address" to the immediate right of the string

Code:
Sub GetChars()
Dim RegX As Object, RegO As Object, RegSub As Object, Cel As Range
    Set RegX = CreateObject("vbscript.regexp")
    RegX.ignorecase = True
    RegX.Global = True
    RegX.Pattern = "(\d{1}|\d{1}.+)(\s{1}\D+\s{1}.*)(Avenue|Court|Place|Close|Street|Parade|Road|Drive|St.|St|Rd.|Rd)(.+)"
    For Each Cel In Selection
        Set RegO = RegX.Execute(Cel.Value)
        If RegO.Count = 1 Then
            Cel.Offset(0, 1) = RegO(0).submatches(0) & RegO(0).submatches(1) & RegO(0).submatches(2)
            Cel.Offset(0, 2) = RegO(0).submatches(3)
        Else
            Cel.Offset(0, 1) = "Invalid address"
        End If
    Next
End Sub

Cheers

Dave
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,392
Members
449,445
Latest member
JJFabEngineering

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top