UK Postcode Area

csimo

New member
Local time
Today, 10:26
Joined
Dec 27, 2017
Messages
4
Hi
Hope you can help.

I am trying to extract the area part of the UK postcode.
the post code format can be
B1 1AA
B43 1AA
BS1 1AA
BS43 1AA

In the above example I only want to extract the B or BS and exclude any numbers or the second part.

Thanks for your help
Chris
 
Thanks for the reply Colin.
I need to remove any number from the query so I just get the letter.

Thanks
Chris
 
Hi
I'd only just woken up and gave you the code for getting the postcode district by mistake. When I realised, I deleted the post.

One way is to compare with a list of postcode areas which I can supply if you wish.
Alternately as you say, you need to extract the part to the left of the first number. If nobody does so first, I'll send code after I'm fully awake.
 
Unfortunately the structure of UK postcodes is very badly designed with:
- postcode areas of one or two characters (B/BS etc),
- postcode districts of 1 or 2 numbers or a number and a character (BS1/BS25/EC1A)
- various exceptions such as the special postcode GIR 0AA (used for the old Girobank) where all 3 characters in the first section are letters

Anyway rant over!
The following expression gets the postcode area for all standard UK postcodes:
Code:
IIf(IsNumeric(Mid([Postcode],2,1)),Left([Postcode],1),Left([Postcode],2))

If you still want a list of UK postcode areas, let me know
 
Hi Colin

Thank you for your code, it has really helped. And I agree with your comment about the post code structure.

Thanks Again
 
I also have these already if you are stuck.
Probably not as up to date or accurate as Colin's list, but painfully hand crafted / checked about 3 years ago.
 
@csimo / @Minty
See attached for the latest Postcode Areas datafile.
You probably won't need all the data it contains but it is up to date (June 2018)

For info, the UK Office for National Statistics (ONS) releases all the latest postcode data every 3 months of which this forms a tiny part.
Its provided free but needs some work to make it user friendly.

I work with Chris Bell who runs the excellent site www.doogal.co.uk to get all this data into a more usable format.

@csimo
I would be missing a trick here if I didn't mention my UK Postal Address Finder app. For more info see: this sample databases thread https://www.access-programmers.co.uk/forums/showthread.php?t=295378

The latest version with additional features is available from my website
A free 15-day evaluation version can also be downloaded if you want to try it out.

Please send me a PM if you want to know more
 

Attachments

Users who are viewing this thread

Back
Top Bottom