Combining formulae for UK postcodes

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
689
Office Version
  1. 365
Hi All

I have a method of sorting out typos and in correct entries of UK postcodes, but it takes 4 helper columns to do it.

Below are the formulae I use to do it, the original postcode is in A2,
In B2 I have =TRIM(A2) this is to get rid of any superfluous spaces at the beginning or end of the postcode
In C2 I have =UPPER(B2) this sort out the case as all the letters need to be upper case
In D2 I have =SUBSTITUTE(C2," ","") this removes any spaces in the wrong place
In E2 I have =IF(LEN(D2)-3=2,LEFT(D2,2)&" "&RIGHT(D2,3),IF(LEN(D2)-3=3,LEFT(D2,3)&" "&RIGHT(D2,3),IF(LEN(D2)-3=4,LEFT(D2,4)&" "&RIGHT(D2,3)))) this puts the space in the correct place.

I have tried combing the formulae together but cant seem to get it to work, are any of you formulae experts able to assist me please so that I just need one formula in B2

Cheers

Paul
 
Glad we could help & thanks for the feedback.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,216,074
Messages
6,128,654
Members
449,462
Latest member
Chislobog

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