ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   formatting (https://www.excelbanter.com/excel-worksheet-functions/90587-formatting.html)

nick

formatting
 
hi...can anyone help me with this zip-code formatting logic? I have a zip
code (could be in any format) in WK1 and using the logic below i need to
populate the zip code in WK2.

N---Numeric
C---Char

For US: The valid format is NNNNN-NNNN
- When US Zip Code length without '-' or ' ' is 5 and < 9 char then use
first 5 positions
- When Us Zip Code length is <5 chars then move space.
- When US Zip code is having alphabet, invalid and blank then move space
- When US zip code is having 9 char width then pass 5-4 format (99999-9999)
- When US Zip Code length without '-' or ' ' is 9 then use first 9 char.
- When Zip is empty or not valid, move '00000' to SAP

For CANADA: The valid format is CNC NCN
- When zip code length is 7 char, move first 7 char
- When zip code length is <7 char, move space
- When zip code is blank and invalid then move space.
- When Zip is empty or not valid, move 'A0A 0A0' to SAP

For London (county code GB):
- zip code must not exceed 9 characters (<=9 char). If 9 char then, move
first 9 char.)
- When Zip is empty or not valid, move '000000000' to SAP

For Other countries:
- Pass as it is.



All times are GMT +1. The time now is 01:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com