Topic Labels: Data Formulas
Solved
459 3
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

I have a column named MIN and need to add leading zeros when the value in column is less than 4 numbers:

 Before After Formula 22 0022 456 0456 10000 10000 88888 88888 999999999 999999999

This is what I have right now but is giving me an error for the largest number:

IF((COUNT(MIN) <= 3), (REPT('0',4 - LEN({MIN} &''))&{MIN}), {MIN}))

1 Solution

Accepted Solutions
16 - Uranus

Try adding a ` & ""` to your initial LEN(), the same way you're handling your second LEN()

``IF((LEN(MIN & "") <= 3), (REPT('0',4 - LEN({MIN} & ''))&{MIN}), {MIN})``

3 Replies 3
16 - Uranus

Change the "COUNT" to a "LEN" and it should work fine:

``IF((LEN(MIN) <= 3), (REPT('0',4 - LEN({MIN} &''))&{MIN}), {MIN})``
5 - Automation Enthusiast

That didn't work for me and am now getting an error message in the column cells, the value is a number, will LEN work with that?

16 - Uranus

Try adding a ` & ""` to your initial LEN(), the same way you're handling your second LEN()

``IF((LEN(MIN & "") <= 3), (REPT('0',4 - LEN({MIN} & ''))&{MIN}), {MIN})``