简体   繁体   中英

Year to Date Excel formula

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

在此处输入图片说明

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? 在此处输入图片说明

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"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM