![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 86
|
I currently import a csv file. One of the columns contains some numbers that have four leading zeros and also some numbers that have a leading alphabetic character. When the csv is imported it drops the leading zeros. If I use the custom format it adds zeros to everything in the column. Is there any way to add zeros back to a cell containing less than 6 characters?
TIA |
|
|
|
|
|
#2 |
|
New Member
Join Date: Mar 2002
Posts: 14
|
There's a couple of ways:
Firstly when you go through the import wizard you will have an opportunity to tell the wizard the kind of cell you are importing, at this stage you change it from "General" to "Text". That way you keep all leading Zeros on the columns you selected. The second way is by using "0" instead of "#" in the custom mode of formating cells. Mark |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
=RIGHT(REPT("0",6-LEN(A1))&A1,6) if multiple leading zeroes are missing or =RIGHT(0&A1,6) if just a single leading zero is missing. |
|
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|