We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

alteryx Community

# Alteryx Designer Discussions

SOLVED

## Adding zero to make it 9 digits

9 - Comet

Hello Alteryx Team,

Needing assistance on the attached dummy input file. If the first column is D3, then the 2nd column should consist of 9 digits. If incase it only consist of less than 9 digits, then add zeroes in the beginning to make it 9:

In the example above, you can see that there are 3 values that does not contain 9 digits.  The output should be like this (all 9 digits) under D3:

9 REPLIES 9
12 - Quasar

If you have leading zeros you'll have to change the field type to a string, then you can simply add the formula..

Hopefully that helps,

Mark

12 - Quasar

Hey @PassION_es

You can do this using the padleft formula:

``PadLeft([TIN], 9, '0')``

Attaching workflow for reference!

11 - Bolide

Use the formula tool and write

``PadLeft([TIN (9 digits)], 9, "0")``

Hope this helps. Please mark as solved if is solved the issue.

13 - Pulsar

You can achieve it by using the below formula

Many thanks

Shanker V

9 - Comet

hello All,

I applied your formula, incorporated it in the conditions but I'm getting the result below:

I think there's something wrong with my conditions.

Can you check on this please? Thanks

13 - Pulsar

Input:

Output:

12 - Quasar

Hey @PassION_es

Remove the below portion of your formula and you should get the expected result:

17 - Castor

``IIF([TYPE] = 'D3', PadLeft([TIN (9 Digits)], 9, '0'), [TIN (9 Digits)])``