Text to Columns/Formula to Separate Address Data

m_geragh

New Member
Joined
Jan 14, 2014
Messages
11
I have tried many different ways to separate the house number from the street name:
=(right) function with 'find' number
text to columns
replacing 'street' with 'address,' etc so I could separate by the ',' but there is so many variables.

Does anybody have an easy way to separate the house number from the street name in the below fictinary sample:

HIGH ROAD NORTH 51
HIGH ROAD NORTH 51
WESTFIED ROAD 26
TYNE CLOSE 12
TYNE CLOSE 18
TYNE CLOSE 31
TYNE CLOSE 32
BANFORD CLOSE 1
BANFORD CLOSE 24
WILLIS AVENUE 3
WILLIS AVENUE 9
WILLIS AVENUE 15
WILLIS AVENUE 17
WILLIS AVENUE 24
WILLIS AVENUE 33
WILLIS AVENUE 34

<colgroup><col></colgroup><tbody>
</tbody>
...

Many Thanks in advance
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
i used google to find the following assuming your data is in column A and starts in A2

=IF(ISERR(FIND(" ",A2)),"",RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))))
 
Upvote 0
Or, since in your examples the Number always forms the final part of the string, in B2:

=--TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",187)),187))

And in C2:

=TRIM(SUBSTITUTE(A2,B2,""))

Regards
 
Upvote 0
Or, since in your examples the Number always forms the final part of the string, in B2:

=--TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",187)),187))

And in C2:

=TRIM(SUBSTITUTE(A2,B2,""))

Regards

Absolutely spot on - thank you!
 
Upvote 0
Heres another.. more typing than the formula and slower.. but in any case..

Code:
Private Sub CommandButton1_Click()
   Dim objRegex, n
    Set objRegex = CreateObject("vbscript.regexp")
    With objRegex
        .Global = True
        .Pattern = "\d*\d$"
        For i = 1 To Range("A" & Rows.Count).End(xlUp).Row
            Set myMatches = .Execute(Cells(i, 1))
            For Each n In myMatches
                    Cells(i, 2).Value = n
            Next n
        Next i
    End With
End Sub
 
Upvote 0
If you are going to use vba you might as well use the split function on the string and return the Nth element
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,320
Members
449,218
Latest member
Excel Master

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