Ahoj, děkuji za reakci.
Jak jsem psal výše již jsem na to přišel, jen jsem to musel trochu upravit viz níže. Jinak ano, pochopil jsi to správně, potřeboval jsem zadat vzorec pomoci VBA.
Range("W3").FormulaR1C1 = "=SUMIFS(C[-1],C[-7],""<""&R[-2]C[-22])"
Range("X3").FormulaR1C1 = "=SUMIFS('20850'!C22,'20850'!C16,"">=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7,'20850'!C16,""<=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7+6)"
Range("Y3").FormulaR1C1 = "=SUMIFS('20850'!C22,'20850'!C16,"">=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7,'20850'!C16,""<=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7+6)"
Range("Z3").FormulaR1C1 = "=SUMIFS('20850'!C22,'20850'!C16,"">=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7,'20850'!C16,""<=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7+6)"
Range("AA3").FormulaR1C1 = "=SUMIFS('20850'!C22,'20850'!C16,"">=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7,'20850'!C16,""<=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7+6)"
Range("AB3").FormulaR1C1 = "=SUMIFS('20850'!C22,'20850'!C16,"">=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7,'20850'!C16,""<=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7+6)"
Range("AC3").FormulaR1C1 = "=SUMIFS('20850'!C22,'20850'!C16,"">=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7,'20850'!C16,""<=""&DATE(YEAR(R1C1),1,-2)-WEEKDAY(DATE(YEAR(R1C1),1,3))+R2C*7+6)"
Děkuji za ochotu.
citovat