View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default creating csv file

I bet that they want each field to be a certain width--not just that one with
the 17 digits.

If that's true, then I'd create a separate column (the 21st) and use a formula
that would combine what I need:

For instance, if column A had to be 20 characters left justified, I could use:
=left(a1&rept(" ",20),20)

And then just build a big old formula that pieces these together:

=LEFT(A1&REPT(" ",20),20)&","&LEFT(B1&REPT(" ",17),17)&","&TEXT(C1,"mm/dd/yyyy")

Then drag that formula down the column (once you get it perfect).

Then you can just copy that column into Notepad and save the file from there.

ps. Usually when these kinds of files are created (fixed width fields), there's
no need for the commas separating each field.

You may want to ask for a clarification before you go too far with this.

pps. And if you do have 17 digit numbers in a field, make sure you enter them
as text.

You can preformat the field as Text
or
use a leading apostrophe when you do the data entry: '12341234123412341

And if you open this text file in excel, you may find that the 16th and 17th
digits got changed to 0's.

Check your work in NotePad.





Julie wrote:

I have an xls spreadsheet with 20 columns of data that I need to convert to a
csv file to transmit to our customer on a regular basis. Everything is
working except for one column where they tell me I must have 17 digits. In
some cases I have no data for those cells and I am supposed to include 17
blanks between the commas in the final csv file where I have no data. In
other cases I have 11 digits and will need to add 6 spaces to end up with 17.

Is there a way to set up my Excel file so that those spaces end up between
the columns in my final csv file?


--

Dave Peterson