ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
1 Day Left! - The Alteryx Community will be temporarily unavailable for a few hours due to implementation of the new SSO experience starting tomorrow at 5pm MDT. Please plan accordingly. For more information, read the blog.

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Adding a zero to start of number

5 - Atom



I need to add a zero to the start of number and have tried a few different ways but haven't managed to get the output I need.


The input data does not have a zero at the start of the number, I am bringing in the data as a string from the input data. The column includes some 4 digit codes and some 3 digit codes, if its a three digit code I want a zero to be included at the start. For example


Current 2100, 335, 100, 306, 3562

Need 2100, 0335, 0100, 0306, 3562


My cell is called ACC_Branch_Code, currently I have tried this


 iif(length([ACC_BRANCH_CODE_ES_4 ])== 4,[ACC_BRANCH_CODE_ES_4 ],"0"+[ACC_BRANCH_CODE_ES_4 ])


Do I need to fix the digits in the cell to force the zero?


Any help would be appreciated.

15 - Aurora

Hey @BBell


In the formula tool try:


PadLeft([ACC_Branch_Code], 4, "0")


Part time Tableau, Part Time Alteryx. Full Time Awesome

Data Lover

13 - Pulsar

convert the number column into string and prefix zero if the length is three,,,

5 - Atom

Thank you this worked

5 - Atom

Awesome! This solution worked for me as well.


Thanks for sharing.