ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add leading zeros (https://www.excelbanter.com/excel-programming/352108-add-leading-zeros.html)

ellen

Add leading zeros
 
Hello,
I have a CAS# field that Excel interprets as a number. As a result, all my
leading zeros are dropped. Is there a way for me to add leading zeros to any
given number to make it become 9 digits?

For instance, I'd like the following to happen:

12345 to become 000012345
123456 to become 000123456
1234567 to become 001234567
12345678 to become 012345678
123456789 to remain 123456789

Thanks to whomever can help me!!

Ellen

Toppers

Add leading zeros
 
You can format the cell(s) as "000000000" (minus the quotes) and this will
insert leading zeros as required.

HTH


"Ellen" wrote:

Hello,
I have a CAS# field that Excel interprets as a number. As a result, all my
leading zeros are dropped. Is there a way for me to add leading zeros to any
given number to make it become 9 digits?

For instance, I'd like the following to happen:

12345 to become 000012345
123456 to become 000123456
1234567 to become 001234567
12345678 to become 012345678
123456789 to remain 123456789

Thanks to whomever can help me!!

Ellen


ellen

Add leading zeros
 
You're beautiful!! Thanks, Toppers.

"Toppers" wrote:

You can format the cell(s) as "000000000" (minus the quotes) and this will
insert leading zeros as required.

HTH


"Ellen" wrote:

Hello,
I have a CAS# field that Excel interprets as a number. As a result, all my
leading zeros are dropped. Is there a way for me to add leading zeros to any
given number to make it become 9 digits?

For instance, I'd like the following to happen:

12345 to become 000012345
123456 to become 000123456
1234567 to become 001234567
12345678 to become 012345678
123456789 to remain 123456789

Thanks to whomever can help me!!

Ellen



All times are GMT +1. The time now is 03:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com