sumif accross multiple worksheets

Ricky Morris

Active Member
Joined
Mar 31, 2002
Messages
363
Sumif doesn't seems to work accross multiple sheets. How do I accomplish the same results either with an array formula or vba. Excel doesn't seems to recognize a range accross multiple sheets as a valid reference: =ISREF(Sheet2:Sheet3!B10) returns a false. I get the same result when I try to pass the following into a custom function:

Cell A1 = mysum(Sheet2:Sheet3!B10), where mysum is:

Public Function mysum(v As Variant)
Application.Volatile
test = WorksheetFunction.Sum(v)
End Function
 
Yogi, it seems like your solution should work for me but I'm a little slow tonight.

Assuming I have 3 sheets with data named A, B and C. On a fourth sheet named Total I want to evaluate the contents of cell A1 of the 3 data sheets and if A1 is = YES then take to sum of cell A2 on that sheet. How would I write the formula you noted to accomplish this?
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi Ricky:

Here we go -- sheet1...
y030811h2.xls
ABCD
1Yes
21
Sheet1


sheet2 ...
y030811h2.xls
ABCD
1No
22
Sheet2


sheet3 ...
y030811h2.xls
ABCD
1Yes
23
Sheet3


and Totals ...
y030811h2.xls
ABCD
14
Totals


The formula in cell A1 is ...

{=SUM(SUMIF(INDIRECT("sheet"&ROW(1:3)&"!A1"),"Yes",INDIRECT("sheet"&ROW(1:3)&"!A2")))}

Would this do?
 
Upvote 0
also, if you've got sheets named "A", "B", "C":

=SUM(SUMIF(INDIRECT(CHAR({65;66;67})&"!A1"),"Yes",INDIRECT(CHAR({65;66;67})&"!A2")))
 
Upvote 0
Yes, that works perfectly. I'm still trying to comprehend how it works but for now I'm happy I found a solution. As usual I can always find a solution here.

Thanks, Yogi.
 
Upvote 0
PaddyD said:
also, if you've got sheets named "A", "B", "C":

=SUM(SUMIF(INDIRECT(CHAR({65;66;67})&"!A1"),"Yes",INDIRECT(CHAR({65;66;67})&"!A2")))

Ah! the Sheets are A, B, and C instead of Sheet1, Sheet2, and Sheet3 -- Thanks -- Paddy.

How about just using ...

=SUM(SUMIF(INDIRECT({"A","B","C"}&"!A1"),"Yes",INDIRECT({"A","B","C"}&"!A2")))

and in this case it does not even need to be an array based formula!
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,673
Members
449,463
Latest member
Jojomen56

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