Postcode format
L - Letter N - Number
LLNN NLL
and
LLN NLL
Does anyone know what validation/formula I need to use, so that users can only enter a postcode in the same format as the 2 variations above?
Postcode format
L - Letter N - Number
LLNN NLL
and
LLN NLL
Does anyone know what validation/formula I need to use, so that users can only enter a postcode in the same format as the 2 variations above?
Are you sure those are the only formats you need - there are other possibilities for UK postcodes....
Audere est facere
This is some event code that I use
![]()
Please Login or Register to view this content.
thanks.
Is it possible to use a formula or is using code the only way i will be able to include validation?
Testing for patterns like those can get quite complex using data validation formulas.. that is one reason why VBA might be better, and also it is a reason why you were asked if those are the only 2 patterns necessary to validate.
Where there is a will there are many ways.
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
thanks.
Is it possible to use a formula or is using code the only way i will be able to include validation?
You said that already.
those are the 2 most common patterns that will be entered, but if it's possible to include other variations in the validation then i would like to do that.
Hi,
Bob's code does that, can't you use this.
@Bob, there's also another one - "[A-Z][A-Z]#[A-Z] #[A-Z][A-Z]"
ok thanks, I'll try it and see.
The postcode for New Scotland Yard is in that format - SW1H 0BG
There are other London postcodes of that type too WC1H.....etc.
You guys on that side are confusing...
ours (Canada) is just one..
[A-Z]#[A-Z] #[A-Z]#
.......the GIRO postcode also breaks the rules - GIR 0AA
I think this is up to date. It gives you more detailed information such as which letters can appear in which positions
Good Link DLL
I only know because something I did broke when someone used a London postcode and everything came crashing down...(well people whining anyway!!)
Hi,
I have this working perfectly in one column however i have 2 columns with 2 different postcodes, how can i get this formula to work on 2 separate columns?
Administrative Note:
Welcome to the forum.
We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.
Please see Forum Rule #4 about hijacking and start a new thread for your query.
If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
NB: as a Moderator, I never accept friendship requests.
Forum Rules (updated August 2023): please read them here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks