Forum Discussion
Dynamic YTD with conditions
- Feb 23, 2022
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.
3rd time is the charm? Should be available for anyone with this link
https://docs.google.com/spreadsheets/d/1vy_xWKHpXD5IB6cAEa0HD9gqmuXuhGl9/edit?usp=sharing&ouid=110359960991872949495&rtpof=true&sd=true
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.
- SanderHaakFeb 23, 2022Copper ContributorThanks! That works great. Good tip by the way about the columns, I just used it for ensuring that if data is added below, the formulas would include that. Is there possibility with formulas to find the 'last value' other than using VBA's?
- HansVogelaarFeb 23, 2022MVP
It's possible, but it would add complexity to the formulas. I'd go with a large enough range, for example rows 8 to 200, or 8 to 1000. It doesn't matter if some or most of those rows are empty.