View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default Problem Importing Fixed Width Data

Your latest sample data produces the following using multiple Find and
Replace in Word:

10106 Female 1 4 1 0 3 6 3 53 114 65 43 64 83 42
10102 Female 0 0 0 10 4 0 14 41 43 44 56 64 41 52
10104 Female 0 0 0 11 8 0 19 41 43 44 58 89 41 60
11082 Female 0 0 0 8 3 0 11 44 47 46 66 64 42 63
11084 Female 0 0 0 3 1 0 4 44 47 46 52 58 42 45
11086 Female 0 0 1 3 4 1 7 44 47 65 52 66 49 54
11262 Female 6 4 7 0 6 17 6 75 84 106 35 77 96 40

This can be copied directly into column A of an Excel worksheet, then
you can use Data | Text-to-columns to parse it.

Hope this helps.

Pete

Pete_UK wrote:
As this is a text file, you could open it in Word and then apply Find
and Replace four times. For the first time you need to:

Find what: <space<manual line
break<space<spaceSex<space:<space
Replace with: leave blank

then click Replace All.

<space means that you type a space, and is based on me copying your
sample data into Word. The <manual line break will show as ^| and can
be obtained on the Find panel by clicking "more" and then "special".

Do Find and Replace again (CTRL-H) and this time just change the word
"Sex" with "Raw scores", leaving the other things the same, then click
Replace All.

CTRL-H again, this time changing "Raw" with "T" and clicking Replace
All.

CTRL-H once more, this time choosing to:

Find what: ID<space#<space:<space
Replace with: leave blank

and clicking Replace All. Doing this with your sample data gave:

10106 Female 1 4 1 0 3 6 3 53 114 65 43 64 83 42

so I would expect you to have 700 lines like this. You can do Find &
Replace a final time to change double spaces to single spaces (between
the numbers). Use File | Save As to save the file with a different
name, but still as a text file.

Start Excel and use File | Open (with "All files *.*" as the file type)
and select your amended text file - in the Data Import Wizard you can
specify <space as a delimiter and that should split your data as you
wish. Insert a new row 1 and add your column headings.

Hope this helps.

Pete

wrote:
I have a data set of about 700 entries from an old Pascal program that
was exported to a text file in this fomat:

ID # : 10106
Sex : Female
Raw Scores : 1 4 1 0 3 6 3
T Scores : 53 114 65 43 64 83 42


I need the headers to be ID#, Sex, Raw Scores 1-7 and T Scores 1-7 and
then to pick up the data and place it in the appropriate cell. Since
the format is inverted, Excel cannot import is correctly. Is there a
script that will accomplish this?

Thank you for your help!!