FORTRAN format conversion
FORTRAN format conversion
(OP)
I have a whole lot of data derived from old FORTRAN punch cards. I have imported this into Excel, but I would like to convert the numbers from the Fortran F5.2 format into "proper" numbers. Some numbers have explicit decimal points given some don't - it's a bit of a mixture.
Does anybody have any ideas on how to do this, or is writing a macro or formula my only way out?
Does anybody have any ideas on how to do this, or is writing a macro or formula my only way out?
Bung
Life is non-linear...





RE: FORTRAN format conversion
So I guess I'm stuck with using a formula - which I have already worked out. I was just hoping that there was a more elegant format conversion option, seeing Fortran has been around a while.
Bung
Life is non-linear...
RE: FORTRAN format conversion
What does your data look like? What do you want the final data to look like.
Bill
RE: FORTRAN format conversion
23123.9876234.546790
I want to convert that, given it is 4F5.2, into
231.23, 0.9876, 234.5, 467.90
Like I said, F5.2 to ordinary numbers in spreadsheet cells, one number per cell.
Bung
Life is non-linear...
RE: FORTRAN format conversion
Best regards
Morten
RE: FORTRAN format conversion
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: FORTRAN format conversion
TTFN
RE: FORTRAN format conversion
The following is a formula to convert the data into a good number however the data must be imported and Excel imports the data in one row not as a column which may present a problem to you.
=IF(ISERR(FIND(".",A1)>0),MID(A1,1,3)&"."&MID(A1,4,2),A1)
Bill
RE: FORTRAN format conversion
Best regards
Morten
RE: FORTRAN format conversion
Everyone else, thanks for the formula and macro ideas, I've already done all that. I was just wondering if I had missed some esoteric function deep inside Excel that would do it without resorting to string manipulation. It seems not!
(You could of course get into a discussion about the usefulness of a number like .0001 when the rest of your data is expected to be of the scaled properly for a F5.2 input. But my data is scaled OK, its just that some of it was put in by a grey-bearded old Fortran purist, and some by a younger person who has never heard of Fortran).
Bung
Life is non-linear...