ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Data Import Question (https://www.excelbanter.com/excel-discussion-misc-queries/231422-data-import-question.html)

Steve Haack

Data Import Question
 
I need to import data into Excel for statistical analysis. The data is being
collected from thousands of PC's in an organization. Each of them generates a
"log" file and places it on a server.

Each file is a text file, tab delimited with a header row, and a data row.
Each file imports perfectly into Excel.

What I would like to do, is concatenate the files into one file, then import
the entire file. I am able to do this by doing: "copy *.log concatenated.txt"
and it creates one file which imports fine.

The problem is that in this concatenated file, every other line is a repeat
of the column headers.

Is there an easy way in Excel to import that file and recognize every other
line as headers and reject them? I am using Excel 2007.

Thanks,
Steve

Jacob Skaria

Data Import Question
 
Insert a temporary column to the left (ie Col A)and number the rows 1,2,3....
Sort with Col B so that headers will be together and then delete header rows
Sort them with ColA ie the sequence number..
Delete the temporary Col A

If this post helps click Yes
---------------
Jacob Skaria


"Steve Haack" wrote:

I need to import data into Excel for statistical analysis. The data is being
collected from thousands of PC's in an organization. Each of them generates a
"log" file and places it on a server.

Each file is a text file, tab delimited with a header row, and a data row.
Each file imports perfectly into Excel.

What I would like to do, is concatenate the files into one file, then import
the entire file. I am able to do this by doing: "copy *.log concatenated.txt"
and it creates one file which imports fine.

The problem is that in this concatenated file, every other line is a repeat
of the column headers.

Is there an easy way in Excel to import that file and recognize every other
line as headers and reject them? I am using Excel 2007.

Thanks,
Steve


Gord Dibben

Data Import Question
 
You can use a helper column.

Enter 1 and 2 in top two cells.

Select both then right-click and drag down.

Release and "Copy Cells"

Autofilter for 1 and delete those visible cells found by the filter.

Or use a macro.

Sub delete_even_rows()
Dim r As Long
Dim rng As Range
Dim numLoops As Long
ActiveSheet.Rows("1:1").EntireRow.Insert
Set rng = Range(Cells(1), Cells(Rows.Count, ActiveCell.Column).End(xlUp))

numLoops = Int((rng.Rows.Count / 2))
For r = 1 To numLoops
rng(r + 1, 1).EntireRow.Delete
Next
End Sub


Gord Dibben MS Excel MVP

On Wed, 20 May 2009 11:00:01 -0700, Steve Haack
wrote:

I need to import data into Excel for statistical analysis. The data is being
collected from thousands of PC's in an organization. Each of them generates a
"log" file and places it on a server.

Each file is a text file, tab delimited with a header row, and a data row.
Each file imports perfectly into Excel.

What I would like to do, is concatenate the files into one file, then import
the entire file. I am able to do this by doing: "copy *.log concatenated.txt"
and it creates one file which imports fine.

The problem is that in this concatenated file, every other line is a repeat
of the column headers.

Is there an easy way in Excel to import that file and recognize every other
line as headers and reject them? I am using Excel 2007.

Thanks,
Steve




All times are GMT +1. The time now is 07:32 AM.

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