Lots of options for retaining or recreating leading zeros.
The "modern" way to import data is using PowerQuery
Handling Leading Zeros and a Little M-Code**** 2016 12 16 Oz du Soleil
Here’s another video with warning about some things that native Excel handles easier than Get & Transform (Power Query) does, but if we have to do this in Get & Transform, here’s how.
Challenge: handling leading zeros.
Excel is known for clipping off leading zeroes. If you need a the month of March to be: 03 Excel will turn it into: 3
Or, account numbers that are always 6 digits,
Excel will turn 002251 into 2251
This video shows how to force native Excel to recognize leading zeros. Also, the M-Code use of
Text.PadStart()
to force Get & Transform to honor leading zeros.
You also see the insertion of steps in a Get and Transform Query, problems with text versus number formatting. Oh!
.
Get Excel to Handle Social Security... **** 2014 03 21
https://www.accountingweb.com/technology/excel/how-to-get-excel-to-handle-social-security-numbers-properly
A senior financial analyst named Lisa asked a question related to Social Security numbers. She periodically receives employee lists where the Social Security numbers aren’t necessarily in a uniform format. For instance, some are all numeric, others have dashes, and some might be text-based. Any data analysis involving look-up functions in Excel requires that our data be clean. Here are some techniques for cleaning up the numbers.
. * eliminate extraneous characters, such as dashes
. * convert text-based numbers to values
. * add the dashes and leading zeroes back
.
********************************
The "mid" school way to handle leading zeros is using formulas
Top 5 Ways to **Add Leading Zeros** (Formulas) / Adding Leading Zeroes to ZIP Codes /
https://excelchamps.com/blog/leading-zeros/
There are few default rules in Excel which can annoy you. One of those rules is you can’t add a zero before a number. The reason behind this is:
A zero before a number makes no sense and no value to the number itself.
Whenever you try to insert a zero before a number, Excel removes it ... <sigh>
. Convert a Number into a Text
. Use Concatenate Function
. Using REPT Function
. Create a Formula with TEXT Function
. Apply Custom Format ?
..
Change or convert number to text in Excel?
https://www.extendoffice.com/documents/excel/671-excel-change-number-to-text.html
Sometimes you may not want the numbers in the cells getting involved in calculating, or you may want to display leading zeros in numbers in cells. For doing so, you may need to change a number into text. The following methods can convert numbers in cells to text in Excel.
. * Convert number to text with Text function
. * Convert number to text with Format Cells command
.
Why You Should Be Using Custom Number Formatting In Excel
https://www.xelplus.com/why-you-should-be-using-custom-number-formatting/
Let’s see a few Excel Custom Number Formatting tips that will not only save you time, but also help you avoid common spreadsheet mistakes.
First, we’ll see the formatting in action and how it helps tell our story in the most effective way. After that, we’ll look at the underlying rules and understand exactly how all this is produced.
The rule is quite simple. Once you remember the rule, you’re set.
. * Scenario #1 – Thousands Separator with Zero-Decimal Precision
. * Scenario #2 – Hide the Zeros
. * The Custom Number Formatting Rule: Pos; Neg; Zero; Text
. * The Interchanging of Format Ideas
. * Reusing Custom Number Formats
. * Preserving Leading Zeroes
. * Adding Text to Numbers
. * A Common Number/Text Mistake
. * The Secret to Hiding Data
. * Resetting the Number Formatting to the Excel Default
ET MR Custom & Conditional Formats.docx.
********************************
These articles tell you how to use the "old school" using the "Text Import Wizard"
! Convert CSV to Excel: how to import CSV files into Excel spreadsheets **** 2014 05 01 Svetlana Cheusheva
https://www.ablebits.com/office-addins-blog/2014/05/01/convert-csv-excel/
In this article you will find 3 quick ways to convert CSV to Excel. You will also learn how to import multiple CSV files in a single workbook and how to handle the cases when some data from a CSV file isn’t correctly displayed in an Excel sheet.
. * How to convert CSV to Excel
. * Converting CSV to Excel: problems and solutions
. * CSV file is incorrectly displayed in Excel (all data is displayed in the 1st column)
. * Leading zeros are lost when you open a CSV file in Excel
. * Values are changed to dates when converting CSV to Excel
. * Importing multiple CSV files in a single Excel workbook
.
Handling Leading Zeros in CSV Files 2020 05 09
https://excelribbon.tips.net/T010262_Handling_Leading_Zeros_in_CSV_Files
When dealing with files containing comma-separated values, you want to make sure that what gets imported into Excel reflects what is really in the file. If you import a file and find that Excel strips off leading zeros from what it imports, there are a number of possible reasons. This tip explains how you can track down the problem and correct it.
.