I would LOVE some help creating a POSTNET function or VB MACRO.
As you may know, the POSTNET format has to be:
zip+4 and drop point and a check digit.
The check digit is:
1. the digits of the zip+4 and the drop point added together
2. 10 minus the MOD of that sum divided by 10 and if the value is 10 the check digit is zero.
3. That final sum can be verified by taking the MOD of the sum plus the check digit divided by 10 which must equal 0.
I accomplished this over several columns. My zip code are stored as xxxxx-xxxx.
The first column adds the zips digits where A2 has the zip+4 and the drop point with a series of IF statements because the Drop Point has a variable string length:
=MID(A2,1,1)+MID(A2,2,1)+MID(A2,3,1)+MID(A2,4,1)+MID(A2,5,1)+MID(A2,7,1)+MID(A2,8,1)+MID(A2,9,1)+MID(A2,10,1)+(IF(LEN(B2) >= 1,MID(B2,1,1),0))+(IF(LEN(B2) >= 2,MID(B2,2,1),0))+(IF(LEN(B2) >= 3,MID(B2,3,1),0))+(IF(LEN(B2) >= 4,MID(B2,4,1),0))+(IF(LEN(B2) >= 5,MID(B2,5,1),0))+(IF(LEN(B2) >= 6,MID(B2,6,1),0))+(IF(LEN(B2) >= 7,MID(B2,7,1),0))+(IF(LEN(B2) >= 8,MID(B2,8,1),0))
(It would also be nice to loop through the exact string legnth of the drop point value instead of that series of if statements)
The next column calculates the check digit and returns zero if the calculation produces 10:
=IF(MOD(C2,10)>0,10-MOD(C2,10),0)
The next column verifies the result:
The last column outputs the data (strips the dash and concatenates the string) and outputs an empty string if the verify field is not 0:
=IF(E2 = 0,(SUBSTITUTE(A2,"-",,1) & D2),"")
Any help making this into a single function to act on a zip column and a drop point column or make it into a macro would be GREATLY appreciated.
Steven
Bookmarks