Excel:Same number of digits in a column
Solved
PierreCompta
-
Vaucluse Posted messages 27336 Registration date Status Contributor Last intervention -
Vaucluse Posted messages 27336 Registration date Status Contributor Last intervention -
Hello,
I received an Excel file where I should have numbers composed of exactly 7 digits, no more, no less, in column A. The problem is that some are made up of 4, 5, or 6 digits.
For example:
123456 when it should be 1234560
12340 when it should be 1234000
1234 when it should be 1234000
I need to add 1, 2, or 3 zeros afterward so that these numbers contain 7 digits.
You can imagine that manually, over multiple lines and files, we wouldn't manage!
Can you help me?
Thank you in advance!
Configuration: Windows 7 / Internet Explorer 8.0
I received an Excel file where I should have numbers composed of exactly 7 digits, no more, no less, in column A. The problem is that some are made up of 4, 5, or 6 digits.
For example:
123456 when it should be 1234560
12340 when it should be 1234000
1234 when it should be 1234000
I need to add 1, 2, or 3 zeros afterward so that these numbers contain 7 digits.
You can imagine that manually, over multiple lines and files, we wouldn't manage!
Can you help me?
Thank you in advance!
Configuration: Windows 7 / Internet Explorer 8.0
4 answers
-
Hello,
in your original file, do all your numbers have 7 digits? -
Hello
123456 =LEN(G5) =IF(H5=6,G5*10,) =LEN(I5)
12340 =LEN(G6) =IF(H6=5,G6*100,) =LEN(I6)
1234 =LEN(G7) =IF(H7=4,G7*1000,) =LEN(I7)
=LEN(G8) =LEN(I8)
12340 =LEN(G9) =IF(H9=6,G9*10,IF(H9=5,G9*100)) =LEN(I9)
a little example
if this can help you
christian-
-
It's good, you guided me! I found it:
I'm sorting my column from smallest to largest. I'm creating a new column with: =A1*10 and I extend the formula to all the 6-digit numbers, then I replace my results with my 6-digit numbers. I multiply by 100 for the 5-digit number cells and by 1000 for those with 4 digits. After that, I reorder everything!
Thank you! -
-
-
Hello
to put it simply:
if the number always has 7 characters or less than 7
for cell A1 in B1:
=A1&REPT(0,7-LEN(A1))
will always give 7 digits by padding with 0s (result in text format)
Best regards
Let's ask ourselves if we are not the only ones who understand what we are explaining? -
Hello,
to absolutely have 7 digits and add 0s if necessary
select your cells, right-click, format cells, custom and put 0000000 this way you will have
0123456
00001234
--
Every problem has a solution...you just have to be persistent.