Mar 28, 2023 02:31 PM - edited Mar 28, 2023 02:32 PM
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}))
Solved! Go to Solution.
Mar 29, 2023 08:01 PM
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})
Mar 28, 2023 11:02 PM
Change the "COUNT" to a "LEN" and it should work fine:
IF((LEN(MIN) <= 3), (REPT('0',4 - LEN({MIN} &''))&{MIN}), {MIN})
Mar 29, 2023 08:02 AM
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?
Mar 29, 2023 08:01 PM
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})