SUMIF MULTIPLE SHEETS

MikeMN

New Member
Joined
Jul 2, 2003
Messages
19
I have used the sumif formula many times ofer the years.

However, I have always only refrences one sheet.

I am now tying to refrence several sheets.

But I am getting a #value error message.

Any thoughts if this can be done.

Thank you

Mike
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
MikeMN said:
I have used the sumif formula many times ofer the years.

However, I have always only refrences one sheet.

I am now tying to refrence several sheets.

But I am getting a #value error message.

Any thoughts if this can be done.

Thank you

Mike

Two options...

1]

=SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!A2:A10"),D2,INDIRECT("'"&SheetList&"'!B2:B10")))

where SheetList refers to a range that lists the relevant sheet names, A2:B10 the relevant range in every sheet in SheetList, and D2 the criterion value.

2] Using the morefunc.xll add-in...

=SUMPRODUCT(--(THREED(Sheet2:Sheet3!$A$2:$A$10)=D2),(THREED(Sheet2:Sheet3!$B$2:$B$10)))

where Sheet2 and Sheet3 are the relevant sheets while A2:B10 is the relevant range and D2 the criterion.
 
Upvote 0
Re: SUMIF MULTIPLE SHEETS Follow up

THANK YOU

I tested Method 1 and it works great.

However,

I have over 100 Sheets in the file, is there a way to get a list of all the sheet names. Then I can name the list as you suggusted.

Mike
 
Upvote 0
Re: SUMIF MULTIPLE SHEETS Follow up

MikeMN said:
THANK YOU

I tested Method 1 and it works great.

However,

I have over 100 Sheets in the file, is there a way to get a list of all the sheet names. Then I can name the list as you suggusted.

Mike

Free ASAP Utilities allows you to construct a sheet index, which you can probably use:

http://asap-utilities.com
 
Upvote 0
Thanks for your input!

For whatever reason, I am not getting the formula to work (I literally copy and pasted your formula in excel and it doesn't work so I am not sure if I am naming my list proberly or what. Used the ASAP module and named the range SheetList. I get a REF# error.
 
Upvote 0
roscoe77 said:
Thanks for your input!

For whatever reason, I am not getting the formula to work (I literally copy and pasted your formula in excel and it doesn't work so I am not sure if I am naming my list proberly or what. Used the ASAP module and named the range SheetList. I get a REF# error.

Did you also try the manual method of constructing the sheet list?
 
Upvote 0
I am thinking the SUMPRODUCT(SUMIF(..)) method only works with a single criteria, yes?

MikeMN said:
I have used the sumif formula many times ofer the years.

However, I have always only refrences one sheet.

I am now tying to refrence several sheets.

But I am getting a #value error message.

Any thoughts if this can be done.

Thank you

Mike

Two options...

1]

=SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!A2:A10"),D2,INDIRECT("'"&SheetList&"'!B2:B10")))

where SheetList refers to a range that lists the relevant sheet names, A2:B10 the relevant range in every sheet in SheetList, and D2 the criterion value.

2] Using the morefunc.xll add-in...

=SUMPRODUCT(--(THREED(Sheet2:Sheet3!$A$2:$A$10)=D2),(THREED(Sheet2:Sheet3!$B$2:$B$10)))

where Sheet2 and Sheet3 are the relevant sheets while A2:B10 is the relevant range and D2 the criterion.
 
Upvote 0
Re: SUMIF MULTIPLE SHEETS Follow up

THANK YOU

I tested Method 1 and it works great.

However,

I have over 100 Sheets in the file, is there a way to get a list of all the sheet names. Then I can name the list as you suggusted.

Mike
Place the code onto Standard module.

Select A1:A100 and enter
=GetWsNames(1,100)
and confirm with Ctrl + Shift + Enter
Code:
Function GetWsNames(StartInd As Long, EndInd As Long)
Dim i As Long, a(), x As Long, n As Long
Application.Valatile
If EndInd > Sheets.Count Then EndInd = Sheets.Count
x = EndInd - StartInd + 1
Redim a(1 To x)
For i = StartInd To EndInd
    n = n + 1
    a(n) = Sheets(i).Name
Next
GetWsNames = Application.Transpose(a)
End Function
 
Upvote 0
Hi! Is there any other option other than using the indirect funtion? Any VLOOKUP option?
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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