Forum Discussion

Aaiken353's avatar
Aaiken353
Copper Contributor
Sep 12, 2020

How to sum values in a cell based on information in a drop-down menu.

Hi All,

I am just wondering if any Excel savvy people could tell me what formula I should use in order to sum the values of a cell in a different sheet based on information from a drop down menu. Basically I would like to be able, for my job have a Month to date figure based on the accumulated values from each week, and have them change based on the I information in my drop down menu.

5 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Aaiken353 

    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.

    • Aaiken353's avatar
      Aaiken353
      Copper Contributor
      Hi Sergei,
      Thanks for getting back to me. I've attached a file. Basically I want to know, using the file as an example, in sheet2 I have weeks with a TY collum and a LY collum, TY figures are entered weekly, but LY figures are all inputted, my issue arises when we move to sheet1 which has months, and a TY and LY collum and a cell 2 has my drop down list with weeks in it. Basically, I now want my LY collum to only sum up the figures based on which week I'm in. So in march when I select week 5, LY collum should be the sum of week 1 to week 4 and April LY should be the sum of only week 5. And then when I select week 6 from my drop down list, March LY remains the same but April LY is now the sum of week 5 and 6 from sheet 2 LY collum. I hope this makes sense.
      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        Aaiken353 

        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.

Resources