sumif accross multiple sheets combined with a variable column

ebotman

Board Regular
Joined
Jun 24, 2004
Messages
89
Hi,

With the info of some threads on mrexcel I have worked out a formula to get the sum of column M over various sheets:

=+SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!$C1:$C100000");"*/"&$C45&"/*"&D$6;INDIRECT("'"&SheetList&"'!$m1:$m100000")))

This works fine, but now I would like to rebuild it to get the sum of a certain column dependent on a variable (in this example the variable is 13, which is column M). I thought this would work:

{=+SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!$C1:$C100000");"*/"&$C45&"/*"&D$6;INDEX(INDIRECT("'"&SheetList&"'!$1:$100000");;13)))}

Nevertheless it gives me a different, incorrect, result.
Does someone know what I am doing wrong?

Thanks!
Emiel
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try...

=SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!C1:C100000");"*/"&$C45&"/*"&D$6;OFFSET(INDIRECT("'"&SheetList&"'!A1:M100000");;$B45-1;;1)))

...where B45 contains the variable, such as 13. Also, if the data extends beyond Column M, adjust the range A1:M100000, accordingly.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,479
Members
448,967
Latest member
visheshkotha

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