trafficzombie
Board Regular
- Joined
- Sep 9, 2011
- Messages
- 63
I am writing a code and have hit a wall with it
I am trying to write a code to decifer if there is anything other than a letter and or number in a cell, the digits are UK post codes (zip codes)
For example
M1 3RW
M26 4GD
TN10 3ER
The first part of the post code can be anything from 2 to 4 digits, the 2nd part always being 3.
What I am having sometimes is there are other digits added by mistake or not space between the two parts, which causes issues when uploading the data and brings an error report on the IT system I use.
For example
M13RW
M26 4GD*
TN10 3ER&
I have written the following code (based on the data being in cell A1 - and running down the A column)
=LEFT(TRIM(A1),3)&" "&MID(TRIM(SUBSTITUTE(A1," ","")),4,3)
But what is happening is with the above post codes above with this forumla is as follows:
M13 RW
M26 4GD (this one is perfect)
TN1 03E
Hope this makes sense and if anyone can help, that would be great
Thanks in advance
I am trying to write a code to decifer if there is anything other than a letter and or number in a cell, the digits are UK post codes (zip codes)
For example
M1 3RW
M26 4GD
TN10 3ER
The first part of the post code can be anything from 2 to 4 digits, the 2nd part always being 3.
What I am having sometimes is there are other digits added by mistake or not space between the two parts, which causes issues when uploading the data and brings an error report on the IT system I use.
For example
M13RW
M26 4GD*
TN10 3ER&
I have written the following code (based on the data being in cell A1 - and running down the A column)
=LEFT(TRIM(A1),3)&" "&MID(TRIM(SUBSTITUTE(A1," ","")),4,3)
But what is happening is with the above post codes above with this forumla is as follows:
M13 RW
M26 4GD (this one is perfect)
TN1 03E
Hope this makes sense and if anyone can help, that would be great
Thanks in advance
Last edited: