SUM a same cell in the RANGE of sheets using SUMPRODUCT(SUMIF(INDIRECT

Tatiana_k

New Member
Joined
Sep 16, 2014
Messages
23
Office Version
  1. 2010
Platform
  1. Windows
Hi guys,

I need to sum all A1 across many sheets with daily data and then put the result in summary sheet and apply this formula to 365 rows in the column.

The formula works if the name of sheets in sequence is number. Number of the sheets with Data set in F1

=SUMPRODUCT(SUMIF(INDIRECT("'*"&ROW(INDIRECT("1:"&F1))&"'!A1"),"<>0"))

But my first sheet is called Summary, second sheet is called Data and the formula stops working.

Would anyone have a tip on how to solve this issue?

Thanks in advance
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi Tatiana_k,

If sheets are contiguous then you can just use SUM
Excel Formula:
=SUM('Sheet 2:Sheet 4'!A1)

1635018410574.png
 
Upvote 0
Hi Tatiana_k,

If sheets are contiguous then you can just use SUM
Excel Formula:
=SUM('Sheet 2:Sheet 4'!A1)

View attachment 49666

Thank you very much. Actually I use this formula right now.

But I’d like to Autofill my column “C” changing the number of the sheets in the cell “E4” every week.

I’m doing this in the column “E”, but I’ can’t find the solution for the sum in the column “C”.

I know it’s much easier to do it in VBA, but right now I need to use a formula.
Cell Formulas
RangeFormula
A7:B18A7='10'!A7
C7:C18C7=SUM('1:10'!P7)
D7:D18D7=$E$4*24
E7:E18E7=INDIRECT(E$4&"!"&CELL("address",D7))-'1'!C7
F7:F18F7=(D7-C7)/D7
G7:G18G7=E7/D7
H7:H18H7=IFERROR(E7/(D7-C7),"")
I7:I18I7=D7-C7-E7
 
Upvote 0
You would need to create a list of sheet names, then refer to that list with the formula. With the list of sheet names in a sheet called "list", starting in A2 something like this should hopefully do it, although it's a bit beyond the tried methods so no guarantees.

Excel Formula:
=SUMPRODUCT(SUMIF(INDIRECT("'"&OFFSET(List!$A$2,0,0,$E$1,1)&"'!A1"),"<>0"))
 
Upvote 0
You would need to create a list of sheet names, then refer to that list with the formula. With the list of sheet names in a sheet called "list", starting in A2 something like this should hopefully do it, although it's a bit beyond the tried methods so no guarantees.

Excel Formula:
=SUMPRODUCT(SUMIF(INDIRECT("'"&OFFSET(List!$A$2,0,0,$E$1,1)&"'!A1"),"<>0"))
Thank you, but I'd like to avoid creating the list. In this case I need to change the end of the list every day and copy-paste the result in the column C, as I’m doing now. =SUM('1:10'!P7); It’s very time consuming operation. I’ve managed to atomise this operation for the simple calculation in the column E; =INDIRECT(E$4&"!"&CELL("address",D7))-'1'!C7 .

Now I change the number in the E4 (for example with the 21 sheets) and this updates the column E with the date from the 21 sheets. I produced the formula for the SUM. =SUMPRODUCT(SUMIF(INDIRECT("'*"&ROW(INDIRECT("1:"&E4))&"'!A1"),"<>0")). It’s working well if the name of sheets in sequence is number and there is no the sheets before. Unfortunately, I have “summury, data, weeks etc...” sheets before my number sheets started.
 
Upvote 0
Have you tried the hidden sheets method?

Hide a sheet called 'First' immediately before the first sheet that should be included in the formula.
Hide a sheet called 'Last' immediately after the last sheet that should be included in the formula. Note that both of these sheets should be completely empty.
Change your formula to
Excel Formula:
=SUM(First:Last!A1)
(change cell as needed for first one then fill down).

Any new sheets added to the workbook between the hidden 'First' and 'Last' sheets will automatically be included in the formula without needing to edit.

If that will not work for you then you will either need to use the list method that I suggested earlier, use the simple formula method that you have to edit each time to include the new sheets, or use vba instead.

I'm not convinced that it will be possible to do it the way that you want to with the newer functions in the latest versions of excel, with something as old as 2010 you are asking the impossible.
 
Upvote 0
Following up, I might have found a way that looks like it should never work but appears to. Note that this was done in office 365 which on occasion does behave slightly differently to older versions for no apparent reason so it may still not work for you.

Note that the formula requires a list of the names of the sheets that are not sequential numbers (summary, data, etc.) if they are to be summed in the formula. The range $F$1:$F$3 in the formula refers to this list.
Excel Formula:
=SUMPRODUCT(SUMIF(INDIRECT("'"&IF(ROW(INDIRECT("1:"&$E$1+COUNTA($F$1:$F$3)))>$E$1,INDEX($F$1:$F$3,ROW(INDIRECT("1:"&$E$1+COUNTA($F$1:$F$3)))-$E$1),ROW(INDIRECT("1:"&$E$1)))&"'!A1"),"<>0"))
 
Upvote 0
Following up, I might have found a way that looks like it should never work but appears to. Note that this was done in office 365 which on occasion does behave slightly differently to older versions for no apparent reason so it may still not work for you.

Note that the formula requires a list of the names of the sheets that are not sequential numbers (summary, data, etc.) if they are to be summed in the formula. The range $F$1:$F$3 in the formula refers to this list.
Excel Formula:
=SUMPRODUCT(SUMIF(INDIRECT("'"&IF(ROW(INDIRECT("1:"&$E$1+COUNTA($F$1:$F$3)))>$E$1,INDEX($F$1:$F$3,ROW(INDIRECT("1:"&$E$1+COUNTA($F$1:$F$3)))-$E$1),ROW(INDIRECT("1:"&$E$1)))&"'!A1"),"<>0"))
 
Upvote 0
Thank you very much..

My sequence of sheets remains constant and the names as well. I need to summarise for ex. 1, 2 3 4 5… to 10 sheets, sometimes 1 2 3 4 …. 15. And so on; I know that with the list it’d work perfectly.

But I need do it without list. I need to use once my formula and then copy-paste through the whole column. Next time than I want to change my number of sheets in the formula, I’ve just change the number in the cell E4 and all value in the column should change automatically, as in the column E.

I tested my formula for Sum with the sequence of sheets with the numeric names. It works well.

Now I have 3 first sheets: “Summary, Data, Week” , then 1 2 3 ….31 and I say to star from 4rd sheet to the number in E4(in our case value 21.

=SUMPRODUCT(SUMIF(INDIRECT("'*"&ROW(INDIRECT("4:"&E4))&"'!A1"),"<>0")).

Formula works, but it summarises from 4rd numeric sheet 4,5,6,7 ….21 instead of 1, 2,3,4,5 …21
 
Upvote 0
Formula works, but it summarises from 4rd numeric sheet 4,5,6,7 ….21 instead of 1, 2,3,4,5 …21
That's because you've told the formula to do that. with "4:" if you use "1:" then it will go from the first sheet.
But I need do it without list.
It is not suddenly going to become possible because it is what you need. As I said above, you will need a list for the sheets that are not in a numeric sequence. Without a list of those sheet names you are limited to the options in post 6.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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