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: :(
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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.
 
Upvote 0
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?

:)
 
Upvote 0
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)
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

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