Hello, I'm trying to the average and standard deviation from the previous 344 calendar days excluding the 7 most previous days for each cell. So for example on the most recent day (day 1) I want to find the average and standard deviation from day 9 to day 344. If I had data for every day there would be 335 days of measurements for each calculation. I know how to find the average and standard deviation over the last 344 days but I'm not sure how to exclude the previous 7 calendar days from that calculation. I do not have 365 days of data but I want a formula that will make the calculation no matter how many months of data are available. In the data I do not have measurements for consecutive days and most of the days have a few measurements.

The Formuals I would use for data over the previous 343 days would be:
AVERAGEIF(A$2:A127,">=" & DATE(YEAR(A127),MONTH(A127),DAY(A127)-343),$B$2:B127)
STDEV.S(IF($A$2:A127>=INT($A127)-343,$B$2:B127)

I'm not sure if changes can be made to these formulas to reach my goal but I would greatly appreciate any help!