How to Keep Leading Zeros in CSV File Format?

KJKirkland

New Member
Joined
Nov 23, 2019
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello!

I am trying to have a column of numbers include leading zeros so they all contain six digits.

Scenario

1. I want all numbers in the first column to have six digits (if they already have 5 digits, add 1 leading zero, 4 digits = 2 leading zeroes, and so on).
2. When I follow a website I found with tips for this process (highlight cells, format cells, category - custom, type 6 0's under type, click OK) - the format of the cell automatically changes to "Special", not custom).
3. Then, when I close the file and re-open it, the numbers are back to the original digits (4 or 2 or whatever) and not the 6 digits with the leading zeros.

Thank you for any help you can provide!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
After you import the CSV and apply your formatting you need to save the file as xlsx. CSVs strip out formatting and pretty much everything except for the data.
 
Upvote 0
Welcome to the MrExcel board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules. Be sure to follow & read the link at the end of the rule too!

If you do cross-post in the future and also provide a link, then there shouldn’t be a problem.
 
Upvote 0
@KJKirkland
Just put '0xxxx at the starting of the number and then save the file to .csv, the numbers will start with leading 0
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top