Forum Discussion

SanderHaak's avatar
SanderHaak
Copper Contributor
Feb 23, 2022
Solved

Dynamic YTD with conditions

Hello,

 

I'm looking for some help with YTD (Year-to-date) calculations. I have a tab with targets, a tab with actuals, and then a sort of dashboard. On the dashboard the user can select the country and the reporting month. I'm looking to find a formula that can calculate the YTD target, based on the choices of the user. In the attached file I've recreated the situation, I have a workaround at the moment but I'd rather avoid that. 

 

File can be found https://docs.google.com/spreadsheets/d/1vy_xWKHpXD5IB6cAEa0HD9gqmuXuhGl9/edit?usp=sharing&ouid=110359960991872949495&rtpof=true&sd=true unfortunately since I had to share it through Google drive, the document becomes Google sheets instead of Excel. Original formula I used was: 

 

=INDEX(Targets!S:AD;MATCH(1;(Targets!R:R=Dashboard!$C$4)*(Targets!Q:Q=Dashboard!$B10);0);MATCH($C$5;Targets!$S$5:$AD$5))

 

C4 = Country

C5 = Month

 

Thanks in advance!

 

Sander

  • SanderHaak 

    Thanks, that worked.

    In Q10:

     

    =SUMPRODUCT(Targets!$D$8:$O$20*(Targets!$B$8:$B$20=$B10)*(Targets!$C$8:$C$20=$C$4)*(YEAR(Targets!$D$5:$O$5)=YEAR($C$5))*(MONTH(Targets!$D$5:$O$5)<=MONTH($C$5)))

     

    Adjust the ranges if needed, but don't use entire columns, that slows down execution. Fill down to Q11.

7 Replies

    • SanderHaak's avatar
      SanderHaak
      Copper Contributor

      HansVogelaar 

       

      Thanks, sorry! https://docs.google.com/spreadsheets/d/1vy_xWKHpXD5IB6cAEa0HD9gqmuXuhGl9/edit?usp=sharing&ouid=110359960991872949495&rtpof=true&sd=true is an updated link. Earlier I could add an attachment here, but that no longer seems to be possible.

Resources