Extract data from multiple file and create summary

Aoic

New Member
Joined
Apr 19, 2011
Messages
14
Hi Macro experts,

I have around 1000 files (all in similar format) stored in one folder. In each file, there is a table like below example - 1. The first row of the table can be any row between 3rd and 16th; the columns and sequence of the header are fixed, always from column A to I (headers are from "Piece name to "Y Dimension")

I want to run a macro, and it goes to all the file in the folder and retrieve data from the table based on column E ("Material"). And create a summary report in a new workbook like example - 2

The Summary records target file name in column A; followed by the unique material code from that file which starts with "L"; followed by the total quantity of each Material code (retrieve from column B in example - 1), and finally the total area of each Material code (retrieve from column B and C using sumproduct in example - 1).

Thank you so much for your help!!

Example - 1
ABCDEFGHI
1Piece nameQuantityAreaPerimeterMaterial codePiece descriptionX DimensionY Dimension
2Part110.223928.04FFabric8.274.22
3Part210.815445.10FFabric10.9410.84
4Part310.809143.25FFabric10.9410.84
5Part420.01686.09Lleather1.142.17
6Part510.256430.37Lleather10.983.32
7Part610.049210.38L1leather - 12.772.38
8Part710.249427.11L1leather - 15.757.27
9Part810.440233.77L1leather - 15.7510.84
10Part910.066626.28L2leather - 211.420.79
11Part1040.034417.06L2leather - 27.370.75
12Part1120.023011.04L3leather - 34.721.10
13Part1220.340633.67TPolyester9.007.91
14Part1310.045422.81XBFiller8.771.99
15Part1420.006931.10XSFiller9.932.65

<tbody>
</tbody>

Example - 2

File nameMaterial
QuantityTotal Area
datasheet-1L30.2899
datasheet-1L130.7388
datasheet-1L250.2042
datasheet-1L320.0461

<tbody>
</tbody>
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
first of all well done giving us such good clear information.

Is it possible to amalgamate all your data into one summary sheet, creating a new column A with sheet1 sheet2 etc in it
 
Upvote 0
sheetPiece nameQuantityAreaPerimeterMaterial codePiece descriptionX DimensionY Dimension
sheet1Part110.223928.04FFabric8.274.22
sheet1Part210.815445.1FFabric10.9410.84
sheet1Part310.809143.25FFabric10.9410.84
sheet1Part420.01686.09Lleather1.142.17
sheet1Part510.256430.37Lleather10.983.32
sheet1Part610.049210.38L1leather - 12.772.38
sheet1Part710.249427.11L1leather - 15.757.27
sheet1Part810.440233.77L1leather - 15.7510.84
sheet1Part910.066626.28L2leather - 211.420.79
sheet1Part1040.034417.06L2leather - 27.370.75
sheet1Part1120.02311.04L3leather - 34.721.1
sheet1Part1220.340633.67TPolyester97.91
sheet1Part1310.045422.81XBFiller8.771.99
sheet1Part1420.006931.1XSFiller9.932.65
sheet2Part170.223928.04FFabric8.274.22
sheet2Part270.815445.1FFabric10.9410.84
sheet2Part370.809143.25FFabric10.9410.84
sheet2Part470.01686.09Lleather1.142.17
sheet2Part570.256430.37Lleather10.983.32
sheet2Part670.049210.38L1leather - 12.772.38
sheet2Part770.249427.11L1leather - 15.757.27
sheet2Part870.440233.77L1leather - 15.7510.84
sheet2Part970.066626.28L2leather - 211.420.79
sheet2Part1070.034417.06L2leather - 27.370.75
sheet2Part1170.02311.04L3leather - 34.721.1
sheet2Part1270.340633.67TPolyester97.91
sheet2Part1370.045422.81XBFiller8.771.99
sheet2Part1470.006931.1XSFiller9.932.65
LL1
sheet10.29000.7388
sheet21.91245.1716
LL1
sheet133
sheet21421
the tables use simple sumproduct formulas

<colgroup><col span="12"></colgroup><tbody>
</tbody>
 
Upvote 0
Hi oldbrewer,

Yes, the summary is amalgamated with all the file in that designated folder (like below revised example)
Thank you very much for your help!

File nameMaterialQuantityTotal Area
datasheet-1L30.2899
datasheet-1L130.7388
datasheet-1L250.2042
datasheet-1L320.0461
datasheet-2L
datasheet-2L1
datasheet-3L
datasheet-3L1

<colgroup><col style="text-align: center;"><col style="text-align: center;"><col style="text-align: center;"><col style="text-align: center;"></colgroup><tbody>
</tbody>

first of all well done giving us such good clear information.

Is it possible to amalgamate all your data into one summary sheet, creating a new column A with sheet1 sheet2 etc in it
 
Upvote 0
Hi oldbrewer,

I think I didn't explain clearly about my needs. Sorry about my English as I'm not native speaker.
The example 1 table is existed in all the excel files in a folder (always in sheet1). I need a macro to pull data from each single excel file from that folder and only extract those with a material code starts with L. Then, the macro creates a summary sheet that list down all unique L material code for every file in that folder, and calculated quantity and total area of each file. Hopefully this time I made it clearer....or not >_<

sheetPiece nameQuantityAreaPerimeterMaterial codePiece descriptionX DimensionY Dimension
sheet1Part110.223928.04FFabric8.274.22
sheet1Part210.815445.1FFabric10.9410.84
sheet1Part310.809143.25FFabric10.9410.84
sheet1Part420.01686.09Lleather1.142.17
sheet1Part510.256430.37Lleather10.983.32
sheet1Part610.049210.38L1leather - 12.772.38
sheet1Part710.249427.11L1leather - 15.757.27
sheet1Part810.440233.77L1leather - 15.7510.84
sheet1Part910.066626.28L2leather - 211.420.79
sheet1Part1040.034417.06L2leather - 27.370.75
sheet1Part1120.02311.04L3leather - 34.721.1
sheet1Part1220.340633.67TPolyester97.91
sheet1Part1310.045422.81XBFiller8.771.99
sheet1Part1420.006931.1XSFiller9.932.65
sheet2Part170.223928.04FFabric8.274.22
sheet2Part270.815445.1FFabric10.9410.84
sheet2Part370.809143.25FFabric10.9410.84
sheet2Part470.01686.09Lleather1.142.17
sheet2Part570.256430.37Lleather10.983.32
sheet2Part670.049210.38L1leather - 12.772.38
sheet2Part770.249427.11L1leather - 15.757.27
sheet2Part870.440233.77L1leather - 15.7510.84
sheet2Part970.066626.28L2leather - 211.420.79
sheet2Part1070.034417.06L2leather - 27.370.75
sheet2Part1170.02311.04L3leather - 34.721.1
sheet2Part1270.340633.67TPolyester97.91
sheet2Part1370.045422.81XBFiller8.771.99
sheet2Part1470.006931.1XSFiller9.932.65
LL1
sheet10.29000.7388
sheet21.91245.1716
LL1
sheet133
sheet21421
the tables use simple sumproduct formulas

<tbody>
</tbody>
 
Upvote 0
to be totally clear then, in one folser you have 1000 .xls files, and in EACH file, sheet1 contains the data you are interested in. You want to pull every row where material code starts with L putting the results into a single sheet.

How many rows in each of the 1000 files ?
 
Upvote 0
Yes, and when pulling out every row starts with L, the macro calculates quantity subtotal and area subtotal (sumproduct of quantity and area) for each L type. for example, there are 3 kinds of material code L1, L2, and L3. the summary will have 3 rows, L1 row with total L1 quantity / area (combining all rows with L1), L2 row with total L2 quantity and area, and same for L3 row.
In those 1000 files, the number of rows changes, but no more than 100.
Thank you very much for your patience :)

to be totally clear then, in one folser you have 1000 .xls files, and in EACH file, sheet1 contains the data you are interested in. You want to pull every row where material code starts with L putting the results into a single sheet.

How many rows in each of the 1000 files ?
 
Upvote 0

Forum statistics

Threads
1,215,786
Messages
6,126,891
Members
449,347
Latest member
Macro_learner

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top