Check Postcode for Correct Character Zero (0) and not Letter (O)

razzandy

Active Member
Joined
Jun 26, 2002
Messages
400
Office Version
  1. 2007
Platform
  1. Windows
Hi Guys, so I have the below Formula where it correctly formats a postcode but now I need it to check the Characters to make sure a Zero (0) is in fact a zero and not a Letter (o)? So a UK Postcode example could be BL1 oLL, so the 'o' in this example would need changing to Zero. As you can imagine it gets more complicated with longer/shorter postcodes! UK postcode formats can be found here: Postcodes in the United Kingdom - Wikipedia.

Excel Formula:
=UPPER(REPLACE(SUBSTITUTE(B5," ",""),LEN(SUBSTITUTE(B5," ",""))-2,0," "))

Thanks in advance! (y) 🙏
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Can't you just Replace all Os with 0s?
=SUBSTITUTE(B5,"O",0)

and perhaps for the whole thing:
=REPLACE(SUBSTITUTE(SUBSTITUTE(B5," ",""),"O",0),4,0," ")
 
Upvote 0

Forum statistics

Threads
1,222,903
Messages
6,168,939
Members
452,227
Latest member
sam1121

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