Splitting the address field: Edie's Question

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Edie provided the following sample at

http://www.mrexcel.com/wwwboard/messages/23005.html

{"10 Westchester Ct";
"102 Crab Tree Ln";
"1002 N 50 E";
"106 N Couty Rd 50 W";
"1066 S Baums Bridge Rd";
"1068 N 100 E"}

which must be split into 2 columns, one holding the initial number, the other the rest of the address.

Activate Tools|Macro|Visual Basic Editor.
Activate Insert|Module.
Paste the UDF that follows in the open space of the window, entitled ...(Code).

Option Explicit

Function REVERSETEXT(text) As String
'
' Returns its argument, reversed
' J. Walkenbach
'
Dim TextLen As Integer
Dim i As Integer
TextLen = Len(text)
For i = TextLen To 1 Step -1
REVERSETEXT = REVERSETEXT & Mid(text, i, 1)
Next i
End Function

Activate File|Close and Return to Microsoft Excel.

Assuming that the first address entry is in A1,

in B1 enter: =LEFT(A1,SEARCH(" ",reversetext(A1)))+0

in C1 enter: =TRIM(REPLACE(A1,1,LEN(B1),""))

Select B1:C1 and give a double click on the little black square on the lower right corner of C1 in order to copy the formulas.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,213,494
Messages
6,113,986
Members
448,538
Latest member
alex78

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