Sum Across Sheets based on Grouping Criteria

detangler

Board Regular
Joined
Oct 21, 2003
Messages
74
Here's what I have:
Book2
ABCD
1Service LineSheet NameGrouping
2X-RaySL1Standalone Imaging
3Computed TomographySL2Imaging Joint Venture
4Magnetic Resonance ImagingSL3Standalone Imaging
5PETSL4East Ambulatory Center
6MammographySL5East Ambulatory Center
7EndoscopySL6(Reserved for Future #2)
8CystoscopySL7East Ambulatory Center
9Nuclear StressSL8West Ambulatory Center
10Cardiac RehabSL9East Ambulatory Center
11EchocardiologySL10Standalone Imaging
12Occupational MedicineSL11Standalone Imaging
13Radiation OncologySL12West Ambulatory Center
14Medical OncologySL13East Ambulatory Center
15Diagnostic CathSL14West Ambulatory Center
16Interventional CathSL15East Ambulatory Center
17OrthopedicsSL16West Ambulatory Center
18Physical TherapySL17East Ambulatory Center
19Wellness CenterSL18(Reserved for Future #1)
20PET-JVSL19(Reserved for Future #1)
21MRI-JVSL20Standalone Imaging
Sheet1


Sheet Name is the name to all of the worksheets that I need to sum. All of these sheets (income statements) are formatted the exact same way. Each of these statements need to roll up to its specified grouping. So the end product is that I will have 6 rollup summary sheets formatted the exact same way as these individual income statement.

I have read and re-read the Index, Match, Indirect, SumIf functions and posts on this site over and over again and just couldn't figure it out. Can someone please help!!! Thank you so much!
 
Brian from Maui said:
I not sure if this is any faster or correct,

=SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!C1:C10"),A2,INDIRECT("'"&SheetList&"'!B1:B10")))

Where SheetList is a named ranged with your sheet names, C1:C10 the criteria range, A2 the criteria and B1:B10 the range to sum. Enter with just Enter.

I don't think that will work. But if the OP is willing to change the 'Input' sheet, it could be made faster. So, in case the OP is interested, here's how it would work...

1) Set-up the 'Input' sheet so that the first row contains the group heading, and their corresponding sheet names are listed below their respective group...

Code:
Standalone Imaging | Imaging Joint Venture
SL1 | SL2
SL3 | 

...and so on

2) Define named ranges for each group. For example, you could name A2:A10, 'Standalone_Imaging', name B2:B10, 'Imaging_Joint_Venture', and so on. Note that these named ranges would be made dynamic so that sheet names can easily be added or deleted.

3) Enter the following formula in B3 and copy to other relevant cells.

=SUMPRODUCT(N(INDIRECT(Standalone_Imaging&"!"&CELL("address",B3))))
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Thank you both for the subsequent insights. I'll try them out. I'm very likely to have more questions later. Thanks!!
 
Upvote 0
=SUM(IF(Sheet1!$C$1:$C$20="Standalone Imaging",N(INDIRECT(Sheet1!$B$1:$B$20&"!"&CELL("address",B3)))))

I am able to use Brian's formula to get where I need to go and now I have a couple of follow-up questions regarding the logic:

1. I'm still not quite sure how the N function works. I looked it up in Excel Help but the explanation seemed straightforward enough but didn't mention anything about "de-referencing". I also looked up the INDIRECT function and it mentioned nothing about the need to "de-reference".

I also tried taking out the N function from the formula Brian provided and it seemed to return only the first element of the array back.

I wonder if someone can find a different way to explain how this work to me.

2. I'm guessing that the reason for using the CELL function in the formula is just so that the formula can be copied down and across without needing to be changed manually.

However, it has been a nightmare whenever rows are added or deleted in the subsequent sheets (SL.....). Each time that happens, I have to go to the Summary sheet to change the cell reference manually. Is there a better way?
 
Upvote 0
1. I'm still not quite sure how the N function works. I looked it up in Excel Help but the explanation seemed straightforward enough but didn't mention anything about "de-referencing". I also looked up the INDIRECT function and it mentioned nothing about the need to "de-reference".

I also tried taking out the N function from the formula Brian provided and it seemed to return only the first element of the array back.

I wonder if someone can find a different way to explain how this work to me.

Try searching the Board using a keyword such as 'de-referencing' and see if that helps...

2. I'm guessing that the reason for using the CELL function in the formula is just so that the formula can be copied down and across without needing to be changed manually.

However, it has been a nightmare whenever rows are added or deleted in the subsequent sheets (SL.....). Each time that happens, I have to go to the Summary sheet to change the cell reference manually. Is there a better way?

Assuming that any change is made uniformly across all relevant sheets, try the following formula instead...

=SUM(IF(Sheet1!$C$1:$C$20="Standalone Imaging",N(INDIRECT(Sheet1!$B$1:$B$20&"!"&ADDRESS(ROW(SL1!B3),COLUMN(SL1!B3))))))

Hope this helps!
 
Upvote 0
I'm sorry... I just realize that it's not Brian's formula that I have used... it's Domenic's. Thank you for the additional explanation as well, Domenic. I will do some more digging and try out the new formula. I will post back later.
 
Upvote 0

Forum statistics

Threads
1,216,038
Messages
6,128,447
Members
449,453
Latest member
jayeshw

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