Import only certain rows from text file

G

Guest

I have a .txt file that I need to import into Excel as fixed length. I need
to import all the odd rows from the .txt file into worksheet 1 and then
import all the even rows from the .txt file into worksheet 2.

Any ideas on how I would do this?

Thanks,

Mike
 
G

Guest

I think you will need to impert them into one sheet.
then you can select only even rows through many methods
helper column with =mod(row(),2)+1
select the helper column copy and paste special values
select all and sort by helper column
select all the rows with 2 in the helper column and cut and paste into sheet 2
 
G

Guest

The only problem with that...and maybe I was not clear enough...is that I
need to parse row one into columns and the fields in row 2 don't match up the
same as row one. Essentially i need to split all odd cells into one fixed
length spreadsheet and all even cells into a different fixed length
spreadsheet.
 
D

Dave Peterson

How about importing all the data into one worksheet in one column (column A).

Then insert a new column A and insert that formula into it.

Then you can convert those formulas to values, and sort by that column.

Then cut the bottom half (of column B) and put it A1 of a new worksheet. And
use Data|Text to columns to parse that the way you want.

And then on the original worksheet, delete that helper column A and use
data|Text to columns to parse that the way you want.
 
G

Guest

I will try that....is this something that a macro could be written for. The
file varies in length each time but that shouldn't make a big difference.
 
D

Dave Peterson

Sure.

You may even want to record a macro when you do it once.

It might be code that even works!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top