Summing cells across different pages, where the pages to add are determined by a cell (INDIRECT question)

Joe94

New Member
Joined
Nov 19, 2010
Messages
20
I have different tabs called Wk1, Wk2, Wk3, etc. which are all exactly the same table where people will enter weekly data. I want to have a YTD tab which is exactly the same table and adds the data from Week 1 to Week X, where X is a number in cell I1. So if I1=4, the formula in cell B5 will add B5 from each of the tabs Wk1, Wk2, Wk3, Wk4.

Could anyone help me? This seems like a simple mixture of SUM and INDIRECT formulas but I keep getting errors. Also as I need to copy the formula over a whole table, I would like B5 to not be fixed so I can just copy and paste it over the whole table. Thanks
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
This is the way id go. Create a named range called 'Weeks' with all of your sheet names in it. Then this should work:

=SUMPRODUCT(SUM(INDIRECT("'"&INDEX(Weeks,1):INDEX(Weeks,$I$1)&"'!"&ADDRESS(ROW(),COLUMN()))))
 
Upvote 0
This worked perfectly, thank you so much! If you don't mind could you please explain how SUM and SUMPRODUCT are working together in this example? I think I understand how most of the formula works by using Evaluate Formula but I am not sure why 2 different SUM equations are required.
Again, thanks a lot for the help.
 
Last edited:
Upvote 0
Its just being used to force excel to use the array of sheets so therefore array of cells. If you dont use it like that it produces erroneous results. This for instance will only use the first sheet/cell in the Weeks named range

=SUM(INDIRECT("'"&INDEX(Weeks,1):INDEX(Weeks,$I$1)&"'!"&ADDRESS(ROW(),COLUMN())))

so then wrapping that with sumproduct makes it use all of the sheets. If you use sumproduct without a sum it similarly fails.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,431
Members
448,961
Latest member
nzskater

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