Controling space when exporting EXCEL to text.

F

FoMoCo-Tom

We have a program that reads files in a fixed format style of FORTRAN. 8 characters per column of data with no delimiter. I want to export a text file from EXCEL such that each column is limited to 8 characters, that it will stuff blanks as fillers. In somecase it will be a fixed number (i.e. 1.2) and other it will be an exponent (i.e. 210E09)

Basically, I need to control the text output of Excel like the good old FORTRAN days.
 
D

Dave Peterson

I found that when I use this technique, it goes a little smoother if I choose a
nice non-proportional font (I use Courier New) so I can see how things look).

But another way is to use a helper cell where you concatenate your values.

=RIGHT(REPT(" ",8)&TEXT(A1,"0.0"),8) & RIGHT(REPT(" ",8)&TEXT(B1,"0E+00"),8)

(modify your formatting to match)

Then copy that column and paste into notepad and save the text file from there.

I also add a cell like this near the top of that column:
=REPT("----+----|",10)
And format the whole column as Courier New

(If I have to do it lots, I'll leave the formulas and hide the column!)
 
Top