I have postal codes from Mexico that are missing 1, sometimes 2, leading zeros. Each postal code needs to be 5 numerical digits. How do I add a leading zero for only these records?
Solved! Go to Solution.
Hi @rjohnson123 you would need to convert your field into a string field the numeric field in Alteryx would remove leading zeros. I mocked up a workflow.
Hi @rjohnson123
The beauty of Alteryx is there are many ways to get the job done. Here is another option for you that uses the Padleft() function in Alteryx.
Like the other posters noted numeric values will not be able to retain the leading zeros. First convert your ZIP Code to a string with a select tool, make sure that the length of the field is at least 5, then with a Formual Tool use the PadLeft() function. You will need to specify the field you want to use, the length the final string needs to be, and the value to put in front of the existing sting. Your function might look like this
Padleft([Postcode],5,"0")
[Postcode] = Zip code field
5 = length of final string (the total length of a ZIP Code)
"0" = value to put to the left of strings shorter than 5
Hope this helps!
Super thank you. This solution has helped me a lot in my challenge in the leading zero's.
User | Count |
---|---|
19 | |
14 | |
13 | |
9 | |
8 |