View Single Post
  #2   Report Post  
Harlan Grove
 
Posts: n/a
Default Unusual data format

"Salty" wrote...
....
I have a client who has been presented with several thousand records
in an unusual format. Each is formatted thus:

Name<CR
Agency<CR
Address<CR
CityStateZip (all in one field)<CR


I'm assuming you didn't mean to have the <CR on a different line.

Phone<CR
Email<CR
<CR
Name<CR
Agency<CR
Address<CR
CityStateZip<CR
Phone<CR
Email<CR
<CR

and so on.

She wants to be able have a standard data file, Excel or CSV to use in a
database. Has anyone seen an automayted method to move these around without
having someone sit and do it manually for several days.


This is a very standard format on Unix systems, and there are very short
perl and awk scripts that would convert it from this format into CSV format.
But if you want an Excel solution, open the file as plain text WITHOUT
parsing anything into fields. The data will be in column A.

If all records have 6 fields each on a separate line followed by a blank
line as record separator, select C2:H2, type

=INDEX($A:$A,(ROW()-2)*7+COLUMN()-2)

hold down a [Ctrl] key and press the [Enter] key. This will put the first
record in C2:H2. Fill C2:H2 down as far as needed. Then select the entire
col C to col H range, copy and paste special as values on top of itself,
delete cols A and B, and save the resulting file either as an .XLS file or a
..CSV file.