Trim / Substitute / Rightfunction question

tpohara

New Member
Joined
Sep 6, 2010
Messages
6
I have an excel spreadsheet with address data I am attempting to separate out into separate columns in Excel.

The data is does NOT have any delimiters (like, or ‘), the spreadsheet has 8000 rows so I would like to automate how it breaks up the data. The end plan is to use Excel to create a CSV(or like) file with proper delimiters.

2100 Streetname Ave City Province L6L 1E3
2300 Streetname Ave City Cityname2 Province L6L 1E6

My approach was to breakout the data backwards (starting with postal Code, then Province, then get the city data then break the remaining info up from the beginning)

The main Cell (F3) Has one row of data:
2100 StreetName (could be two fields) Drive City (could be two names) Province L6L 1E3 (Last field being Postal code, which is two fields for example.).

In Cell Q3:
=TRIM(RIGHT(SUBSTITUTE(F3," ",REPT(" ",50)),50))

Result is good : 1E3

In Cell P3:
=TRIM(SUBSTITUTE(RIGHT(SUBSTITUTE(F3," ",REPT(" ",50)),75),Q3,""))

Result is good: L6L

In Cell O3:
=TRIM(CONCATENATE(P3," ",Q3))

Result is good: L6L 1E3

In Cell N3:
=TRIM(SUBSTITUTE(SUBSTITUTE(RIGHT(SUBSTITUTE(F3," ",REPT("”,50)),200),Q3,""),P3,""))

Result is good: Province

In Cell M3: (I create a Concatenated field)
=CONCATENATE(N3," ",O3)

Result is good: Province L6l IE3

When I attempt to strip the combination of Province and Postal code from the address (due to the fact the city etc have more than one name etc) I fail

Problem,

When I attempt to strip out the Province and Postal code in order to process the city names it just will not work. Here is the formula I am using:

In Cell L3:
=TRIM(SUBSTITUTE(F3,F3&" "&M3,""))

Will not strip the data from the main data, no matter what I try I just keep getting the same (original data)

Any ideas? I appreciate your time.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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