alteryx Community

# Alteryx Designer Discussions

## Adding zero in front of the value

10 - Fireball

Dear community,

I would like to ask how we going to add zero in front of value below so that the length of value for each row is five. My main goal is i want to make all the value under column A , the length all is five, by adding those zero in front.

However, it is quite flexible which mean some value need to add two zero and some need to add three zero, how do we able to aumatically adding zero in front so that all value is 5 in length

Many thanks for the support

2 REPLIES 2
16 - Nebula

Hey @SH_94,

Slightly inelegant but you can use a formula like this:

``````IF Length([Input]) = 5 THEN [Input]
ELSEIF Length([Input]) = 4 THEN "0"+[Input]
ELSEIF Length([Input]) = 3 THEN "00"+[Input]
ELSEIF Length([Input]) = 2 THEN "000"+[Input]
ELSEIF Length([Input]) = 1 THEN "0000"+[Input]
ELSE "00000" ENDIF``````

The community has some quick and easy videos on formulas and the Formula Tool here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Writing%20...