How do I get the sum of data from multiple sheets based on a certain criteria?

sajanvgs

New Member
Joined
Jul 24, 2015
Messages
6
How do I get the sum of data from multiple sheets based on a certain criteria to a summary sheet, either using formula or vba?

For example
Currently I have two worksheets but this can go up to 13 or 15 worksheets, I want the sum to be shown on summary sheet (sumsheet) for each week separately and the row count for each worksheet will differ.

Worksheet (Data1) has
[TABLE="width: 348"]
<tbody>[TR]
[TD]Date
[/TD]
[TD]Name
[/TD]
[TD]Qty
[/TD]
[TD]Week
[/TD]
[/TR]
[TR]
[TD]2-Jan-15
[/TD]
[TD]Tim
[/TD]
[TD]25
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]2-Jan-15
[/TD]
[TD]Tom
[/TD]
[TD]54
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]3-Jan-15
[/TD]
[TD]James
[/TD]
[TD]34
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]4-Jan-15
[/TD]
[TD]Jack
[/TD]
[TD]77
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]5-Jan-15
[/TD]
[TD]Eric
[/TD]
[TD]19
[/TD]
[TD]2
[/TD]
[/TR]
</tbody>[/TABLE]

Worksheet (Data2) has
[TABLE="width: 354"]
<tbody>[TR]
[TD]Date
[/TD]
[TD]Name
[/TD]
[TD]Qty
[/TD]
[TD]Week
[/TD]
[/TR]
[TR]
[TD]5-Jan-15
[/TD]
[TD]Tim
[/TD]
[TD]77
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]6-Jan-15
[/TD]
[TD]Tom
[/TD]
[TD]54
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]21-Jan-15
[/TD]
[TD]Patrick
[/TD]
[TD]44
[/TD]
[TD]7
[/TD]
[/TR]
[TR]
[TD]7-Jan-15
[/TD]
[TD]James
[/TD]
[TD]34
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]8-Jan-15
[/TD]
[TD]Jack
[/TD]
[TD]25
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]14-Jan-15
[/TD]
[TD]Tim
[/TD]
[TD]12
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]5-Jan-15
[/TD]
[TD]Eric
[/TD]
[TD]36
[/TD]
[TD]2
[/TD]
[/TR]
</tbody>[/TABLE]

Worksheet (sumsheet) were the “1”, “2” …. Stands for the week

[TABLE="width: 236"]
<tbody>[TR]
[TD]1
[/TD]
[TD]Total Qty
[/TD]
[/TR]
[TR]
[TD]Tim
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Tom
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]James
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Jack
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Eric
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Patric
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Total Qty
[/TD]
[/TR]
[TR]
[TD]Tim
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Tom
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]James
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Jack
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Eric
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Patric
[/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,

Try entering all your tab names (like data1;data2) in a range on sheet and define a name for the range, eg: Sheetlist.
See my example below.


Book1
ABCD
11Total QtyData1
2Tim25Data2
3Tom54
4James34
5Jack0
6Eric0
7Patrick0
8
92Total Qty
10Tim77
11Tom54
12James34
13Jack102
14Eric55
15Patrick0
16
177Total Qty
18Tim0
19Tom0
20James0
21Jack0
22Eric0
23Patrick44
Sheet3
Cell Formulas
RangeFormula
B2=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$1,INDIRECT("'"&Sheetlist&"'!b:b"),A2))
B3=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$1,INDIRECT("'"&Sheetlist&"'!b:b"),A3))
B4=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$1,INDIRECT("'"&Sheetlist&"'!b:b"),A4))
B5=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$1,INDIRECT("'"&Sheetlist&"'!b:b"),A5))
B6=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$1,INDIRECT("'"&Sheetlist&"'!b:b"),A6))
B7=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$1,INDIRECT("'"&Sheetlist&"'!b:b"),A7))
B10=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$9,INDIRECT("'"&Sheetlist&"'!b:b"),A10))
B11=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$9,INDIRECT("'"&Sheetlist&"'!b:b"),A11))
B12=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$9,INDIRECT("'"&Sheetlist&"'!b:b"),A12))
B13=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$9,INDIRECT("'"&Sheetlist&"'!b:b"),A13))
B14=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$9,INDIRECT("'"&Sheetlist&"'!b:b"),A14))
B15=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$9,INDIRECT("'"&Sheetlist&"'!b:b"),A15))
B18=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$17,INDIRECT("'"&Sheetlist&"'!b:b"),A18))
B19=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$17,INDIRECT("'"&Sheetlist&"'!b:b"),A19))
B20=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$17,INDIRECT("'"&Sheetlist&"'!b:b"),A20))
B21=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$17,INDIRECT("'"&Sheetlist&"'!b:b"),A21))
B22=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$17,INDIRECT("'"&Sheetlist&"'!b:b"),A22))
B23=SUMPRODUCT(SUMIFS(INDIRECT("'"&Sheetlist&"'!c:c"),INDIRECT("'"&Sheetlist&"'!d:d"),$A$17,INDIRECT("'"&Sheetlist&"'!b:b"),A23))
Named Ranges
NameRefers ToCells
Sheetlist=Sheet3!$D$1:$D$2
 
Upvote 0
This is possible if the customer list is small but what if the customer list is very huge, and keeps on repeating in each sheet. I receive each data sheet in a CSV extension and import it separately to each worksheet, I believe including all the data from different vendor under one sheet will not be possible.

It would be easier to calculate the gross sales in each week from different worksheet based on the criteria week number for different customers.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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