Sep 12 2020 09:51 AM
Sep 12 2020 01:54 PM
That's bit abstract. Do you have hundreds of sheets and their number is variable, or few fixed number of sheets. What is the logic which links returned from drop-down value and values to sum - by position, by ID, by some calculations, etc. Is it one number from each sheet to sum or ranges which are to be summed. Perhaps more questions, but better to have small sample file which illustrates the task.
Oct 01 2020 03:00 PM
Oct 02 2020 09:35 AM
Thank you for the file. Main question here is how Excel knows which week belongs to which number. Assume your Week #1 is from March - from first of march even if it is Sunday, or from first Monday of March or something else. Next, let assume 3 days of Week #5 are in March, rest are in April. Is that March week or April week?
We may create helper table with such mapping, but it will be for the concrete year. Next year days could be shifted and Week #5 from March will go on April. Better to define formal logic, after that with help of WEEKNUMBER() calculate which week is in which month.
As soon as we know that we may calculate the summary for each month, depends on selected week is within the month or after / before it.
Oct 03 2020 04:07 PM
Oct 04 2020 11:26 AM
When it'll be more complex.
First, we need to transfer to Excel your knowledge that WEEK1, WEEK2, WEEK3, WEEK4 are belong to March, another ones to April, etc.
Second, we need normalize names of weeks. Somewhere they are like "Week1", somewhere "Week 1" which is not the same. Sorting and compare texts could give wrong results. For example, if we compare texts like Week2 and Week12, first will be greater (or later) than the second.
Without formal logic of how to calculate weeks we may add helper range at any place of the workbook as
note, we use numbers for weeks, not texts. With that formula could be
=SUMPRODUCT(
($E$4:$E$11<=--SUBSTITUTE($A$2,"WEEK",""))*
($F$4:$F$11=$A4)*
(--SUBSTITUTE(Sheet2!$A$3:$A$10,"WEEK ","")<= --SUBSTITUTE($A$2,"WEEK",""))*
Sheet2!$C$3:$C$10
)