0
votes

I have a worksheet with four diffrent sheets: Total, January, February and March. Each sheet has sales for product A and B.

enter image description here

In total sheet I have a list with the three months and when I select a specific month, the values changes in cells B6 and C6, which is good. The following formula is locatated at those cells: =INDIRECT("'"&$C$2&"'!"&"B3") and =INDIRECT("'"&$C$2&"'!"&"C3")

Now, I need to know a year to date value depending on selected month. For example, I have 10 sales in January for product A and 12 sales in February for the same product. If I select in total sheet February month, what formula can I use to have 22 sells? enter image description here

1

1 Answers

1
votes

Here is how to do it.

In cell B7, enter this formula:

=SUMPRODUCT(SUMIF(INDIRECT(J2:INDEX(J:J,MATCH(C2,J:J,))&"!b3"),"<>0"))

In cell C7, enter this formula:

=SUMPRODUCT(SUMIF(INDIRECT(J2:INDEX(J:J,MATCH(C2,J:J,))&"!c3"),"<>0"))