ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Import only certain rows from text file (https://www.excelbanter.com/excel-discussion-misc-queries/145792-import-only-certain-rows-text-file.html)

MikeD1224

Import only certain rows from text file
 
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

bj

Import only certain rows from text file
 
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


"MikeD1224" wrote:

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


MikeD1224

Import only certain rows from text file
 
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.

"bj" wrote:

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


"MikeD1224" wrote:

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


Dave Peterson

Import only certain rows from text file
 
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.


MikeD1224 wrote:

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.

"bj" wrote:

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


"MikeD1224" wrote:

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


--

Dave Peterson

MikeD1224

Import only certain rows from text file
 
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.

"Dave Peterson" wrote:

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.


MikeD1224 wrote:

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.

"bj" wrote:

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


"MikeD1224" wrote:

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


--

Dave Peterson


Dave Peterson

Import only certain rows from text file
 
Sure.

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

It might be code that even works!!!

MikeD1224 wrote:

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.

"Dave Peterson" wrote:

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.


MikeD1224 wrote:

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.

"bj" wrote:

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


"MikeD1224" wrote:

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


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com