Removing specific data from within a field

tmcleod

New Member
Joined
Jul 9, 2007
Messages
10
I have the following data and other similar data (around 3000 rows in total) each with an address as outlined below in each row

Business 21487 Streatham High Road London SW16 3QG

And I want to extract the postcode data and put into a seperate field.

How can I do this? :unsure: :(
 

Some videos you may like

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

footej

New Member
Joined
Aug 23, 2007
Messages
7
You may have to modify this formula for a distinct list of cities in your range, but it'll work for London

=MID(A1,FIND("London",A1)+7,8)

A1 is the reference of your address

the +7 starts after the space following london, so if your city length varies, the 7 will have to be modifies, as will the 8 if it's a varying lenght of postal codes.
 

tmcleod

New Member
Joined
Jul 9, 2007
Messages
10
Thanks a lot! That worked well for London.

Wanted to know if it possible to use V-LOOKUP to enter more cities and adjust appropriately to give me results for more cities and if so how?

:)
 

njimack

Well-known Member
Joined
Jun 17, 2005
Messages
7,764
The following isn't city-dependent, and seems to work for postcodes of 7 characters as well...

=MID(A1,FIND(" ",A1,FIND(" ",A1,LEN(A1)-10))+1,8)
 

facethegod

Well-known Member
Joined
Aug 1, 2006
Messages
767
try this in A1 assuning the postal code is SW16 3QG

Code:
=RIGHT(A1,LEN(A1)-FIND("#",SUBSTITUTE(A1," ","#",LEN(A1)-1-LEN(SUBSTITUTE(A1," ","")))))



HTH
 

footej

New Member
Joined
Aug 23, 2007
Messages
7
Sure, but to do that you'll need to pull out the city to build a table for your vlookup to reference, which is essentially the same process as pulling out the postal code. Here is another option.

You can copy your addresses into notepad, ctrl + H Find " " with "|" (omit quotes) and import this file into Excel using delimited and in the Other box type in |

Your postal code will always be the last 1 or 2 colums depending on if there is a space in the code as in your example.

At this point I would write a macro that starts in column N or something far away from your results, turn on relative reference and type in "=" then ctrl + Left Arrow twice, then in the next colums do the same thing

ctrl + Left Arrow takes you to the next cell with a value. then you can do while or just F5 3000 times.

Enjoy
 

Watch MrExcel Video

Forum statistics

Threads
1,122,554
Messages
5,596,811
Members
414,104
Latest member
imamalidadashzada

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
Top