VBA - combine multiple worksheets and sum totals

wibni

New Member
Joined
Jun 15, 2011
Messages
33
Hi,

I'm using Excel 2003.
I have an Excel File with 12 Sheets named P1 to P12.
Is it possible to combine these sheets into an additional sheet and summing up the individual totals to a grand total?

If Cells A to G from one sheet, matches the other sheet, then copy range (A:G) and sum up the totals to a grand total in column H.

I think I can figure out how to copy from one sheet to another but am not sure how to compare a range of cells from different sheets.

I've copied 2 sheets as an example below.
Any help is much appreciated.

Sheet P1:

Excel Workbook
ABCDEFGH
1AcctIDSubCategoryCountryAccSegmentManCoRigSiteSite JanTotal
210-4110-008Revenue10411010008GGM-165,284
310-4110-024Revenue10411010024GGM-226,452
410-4420-021Revenue10442010021NMM0
510-4420-NMMRevenue10442010NMMNMM0
610-4430-008Revenue10443010008GGM-12,616
710-4430-029Revenue10443010029GGM-263
810-4430-066Revenue10443010066N\A-2,576
910-4430-073Revenue10443010073N\A0
1010-4430-005Revenue10443010005NMM-7,482
1110-5111-008Direct Expenses10511110008GGM13,952
1210-5111-028Direct Expenses10511110028GGM8,487
1310-5111-029Direct Expenses10511110029GGM4,575
1410-5111-038Direct Expenses10511110038GGM4,492
P1



Sheet P2:

Excel Workbook
ABCDEFGH
1AcctIDSubCategoryCountryAccSegmentManCoRigSiteSite FebTotal
210-4110-008Revenue10411010008GGM-158,815
310-4110-066Revenue10411010066GGM-177,535
410-4110-073Revenue10411010073GGM-191,822
510-4110-029Revenue10411010029N\A0
610-4110-048Revenue10411010048N\A0
710-4110-049Revenue10411010049N\A0
810-4110-005Revenue10411010005NMM-142,615
910-4110-032Revenue10411010032NMM-205,194
1010-4110-042Revenue10411010042NMM-184,471
1110-4420-008Revenue10442010008GGM-6,335
1210-4420-024Revenue10442010024GGM-37,950
1310-4420-028Revenue10442010028GGM-18,282
1410-4420-055Revenue10442010055GGM-6,335
P2
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Thank you for the link.

As I said, I can figure out how to copy data from 1 sheet to a summary sheet - and I think this is what the link explains as well.

What I'm not sure about is how to compare each sheet with another and sum up the rows which are identical for range(A:G).
 
Upvote 0
Good point, but unfortunately not.
It would have to be summed up based on at least AcctID (A) and RigSite (F).
 
Upvote 0
Try like this

=SUMPRODUCT(--(A1:A1000=""10-4110-008"),--(F1:F1000="008"),H1:H1000)

You can replace the literals like "008" with cell references.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,853
Members
452,948
Latest member
UsmanAli786

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