Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing data into excel

Status
Not open for further replies.

JoeM6

Programmer
Aug 5, 2000
53
0
0
US
gamecentral.20m.com
I have a CSV file. It has 9 digit part numbers in it. Some of the part numbers begin with zeros. The zeros are there in the CSV file, but when I open it up in excel, they are removed. Is there away I can format the cells to text before opening the file so the zeros are there?



JoeM6
JPMJR11@aol.com
 
not sure if u you can do it straight but there are easy work arounds!

1. Make a code that will go and add zeros
2. Simpler solution import all the data and use
=text(cell name (e.g. A1),"000000000")
will do what you want. So if it is only one column u can insert a new column use the formula above and just hide or delete the old column (if you delete remember to copy and paste values first)

tell me if you need more help

Ramzi
 
Hi JoeM6,

You can do what you want by just setting the format for the relevant cells.

Just select the cells and then select Format, Cells, Number, Custom, and select the 0 line and extend it to have 9 zeros. If you put a 1 in one of the cells it should show as 000000001.

Good Luck!

Peter Moran
Two heads are always better than one
 
Joe,

I think the best way to fix this issue permentalty is in the column next to your part numbers put the following formula; =TEXT(A1,"000000000") assuming your part # was in a1, and then autofill it down the column. then copy the column with the formula in it and Paste Special/Values on top of it, and Then delete your original column, this way it will not just be a formating mask.

Regards,

Wray
 
two other options;

in the CSV file, put double quotes around the 9 digit number.

change the file type to .txt from .csv, then follow the dialog that follows the file|open of the.txt file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top