Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
devil135
 
Posts: n/a
Default Need to sum up numerous columns in different worksheet into 1

Hi,

I generate 100-200s .csv files end of each month for my company.

Each of these .csv files have numerous data that I need to sum up for a
report.
(Example: 1.csv have 3 columns with things like, item A, item C, item D etc
and 2.csv have columns with item B, item C and item E... and so on and so on)

I am required to sum up all these 100-200s .csv files and have a total sum
of how many of each items appeared and used by the users.
(Example: item A - total count 100, item B - total count 20.. .etc etc)

Is there a way I could do it without going through each of the .csv files
and counting them manually?

The number of columns and the number of name of the items (the same name for
each item are in used) are not fix in each .csv files.

Could anyone please help me with a solution?


Regards,
Lee
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Lee,

Post two small data tables as examples, and a third showing what you would
like to have as the result of the combination. I just wrote a macro that
would combine
File1:
Data1 Data2 Data3
1 2 3
4 5 6

File2:
Data3 Data4 Data5
7 8 9
10 11 12

into:

Source Data1 Data2 Data3 Data4 Data5
File1 1 2 3
File1 4 5 6
File2 7 8 9
File2 10 11 12


If that is what you are looking for, post again.

HTH,
Bernie
MS Excel MVP


"devil135" wrote in message
...
Hi,

I generate 100-200s .csv files end of each month for my company.

Each of these .csv files have numerous data that I need to sum up for a
report.
(Example: 1.csv have 3 columns with things like, item A, item C, item D

etc
and 2.csv have columns with item B, item C and item E... and so on and so

on)

I am required to sum up all these 100-200s .csv files and have a total sum
of how many of each items appeared and used by the users.
(Example: item A - total count 100, item B - total count 20.. .etc etc)

Is there a way I could do it without going through each of the .csv files
and counting them manually?

The number of columns and the number of name of the items (the same name

for
each item are in used) are not fix in each .csv files.

Could anyone please help me with a solution?


Regards,
Lee



  #3   Report Post  
devil135
 
Posts: n/a
Default

Hi Bernie,

Actually I am looking for something like this instead;

example as below,

File1:
Item A Item B Item C

File2:
Item A Item C Item D Item E

File3:
Item A Item B Item D Item E Item F

Into:

Source Item A Item B Item C Item D Item E Item F
Sum 3 2 2 2 2
1

This is what I am looking for.

Thank you.

Regards,
Lee

"Bernie Deitrick" wrote:

Lee,

Post two small data tables as examples, and a third showing what you would
like to have as the result of the combination. I just wrote a macro that
would combine
File1:
Data1 Data2 Data3
1 2 3
4 5 6

File2:
Data3 Data4 Data5
7 8 9
10 11 12

into:

Source Data1 Data2 Data3 Data4 Data5
File1 1 2 3
File1 4 5 6
File2 7 8 9
File2 10 11 12


If that is what you are looking for, post again.

HTH,
Bernie
MS Excel MVP


"devil135" wrote in message
...
Hi,

I generate 100-200s .csv files end of each month for my company.

Each of these .csv files have numerous data that I need to sum up for a
report.
(Example: 1.csv have 3 columns with things like, item A, item C, item D

etc
and 2.csv have columns with item B, item C and item E... and so on and so

on)

I am required to sum up all these 100-200s .csv files and have a total sum
of how many of each items appeared and used by the users.
(Example: item A - total count 100, item B - total count 20.. .etc etc)

Is there a way I could do it without going through each of the .csv files
and counting them manually?

The number of columns and the number of name of the items (the same name

for
each item are in used) are not fix in each .csv files.

Could anyone please help me with a solution?


Regards,
Lee




  #4   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Lee,

If you actually have .csv files, then you could use something like the macro
below. Put the code into a codemodule of a new workbook, save the workbook,
then run the macro. Select the CSV files when prompted. This will work as
long as you have fewer than 254 unique items.

HTH,
Bernie
MS Excel MVP

Sub CountFromSelectedFiles()
Dim filearray As Variant
Dim myBook As Workbook
Dim myCell As Range
Dim i As Integer

With Application
.DisplayAlerts = False
.EnableEvents = False
.ScreenUpdating = False
End With

filearray = Application.GetOpenFilename(MultiSelect:=True)

ThisWorkbook.Worksheets(1).Cells.Clear

If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Set myBook = Workbooks.Open(filearray(i))
For Each myCell In ActiveSheet.UsedRange
If myCell.Value < "" Then
If Not (IsError(Application.Match(myCell.Value, _
ThisWorkbook.Worksheets(1).Range("1:1"), False))) Then
With ThisWorkbook.Worksheets(1).Cells(2, _
Application.Match(myCell.Value, _
ThisWorkbook.Worksheets(1).Range("1:1"), False))
.Value = .Value + 1
End With
Else
With ThisWorkbook.Worksheets(1).Range("IV1"). _
End(xlToLeft)(1, 2)
.Value = myCell.Value
.Offset(1, 0).Value = 1
End With
End If
End If
Next myCell
myBook.Close False
Next i
End If

ThisWorkbook.Save

With Application
.DisplayAlerts = True
.EnableEvents = True
.ScreenUpdating = True
End With

End Sub



"devil135" wrote in message
...
Hi Bernie,

Actually I am looking for something like this instead;

example as below,

File1:
Item A Item B Item C

File2:
Item A Item C Item D Item E

File3:
Item A Item B Item D Item E Item F

Into:

Source Item A Item B Item C Item D Item E Item F
Sum 3 2 2 2

2
1

This is what I am looking for.

Thank you.

Regards,
Lee

"Bernie Deitrick" wrote:

Lee,

Post two small data tables as examples, and a third showing what you

would
like to have as the result of the combination. I just wrote a macro that
would combine
File1:
Data1 Data2 Data3
1 2 3
4 5 6

File2:
Data3 Data4 Data5
7 8 9
10 11 12

into:

Source Data1 Data2 Data3 Data4 Data5
File1 1 2 3
File1 4 5 6
File2 7 8 9
File2 10 11 12


If that is what you are looking for, post again.

HTH,
Bernie
MS Excel MVP


"devil135" wrote in message
...
Hi,

I generate 100-200s .csv files end of each month for my company.

Each of these .csv files have numerous data that I need to sum up for

a
report.
(Example: 1.csv have 3 columns with things like, item A, item C, item

D
etc
and 2.csv have columns with item B, item C and item E... and so on and

so
on)

I am required to sum up all these 100-200s .csv files and have a total

sum
of how many of each items appeared and used by the users.
(Example: item A - total count 100, item B - total count 20.. .etc

etc)

Is there a way I could do it without going through each of the .csv

files
and counting them manually?

The number of columns and the number of name of the items (the same

name
for
each item are in used) are not fix in each .csv files.

Could anyone please help me with a solution?


Regards,
Lee






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't insert columns between columns smooth operator Excel Discussion (Misc queries) 1 May 1st 05 11:53 PM
Works in all columns but one Doug Mc New Users to Excel 2 February 19th 05 02:05 AM
Works in all columns but one?? Doug Mc New Users to Excel 2 February 12th 05 06:37 PM
Put the result of the calculation between 2 columns in a new works Metin Excel Discussion (Misc queries) 3 January 4th 05 12:06 PM
Columns in Excel will not allow user to click in them Kim Excel Discussion (Misc queries) 1 December 28th 04 07:37 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"