Doing some sports statistical analysis for fun. Wonder if any of you guys can help me.
This is the sheet I'm working with. I'm sure you can see how I'm already experimenting with this in the Z-Score rushing attempts column. I already know how to find Z-Score with formula in Sheets using AVERAGE and STDEV. What I have done in the past is just find the Z-Score for every cell in a fixed five-year range. So, for instance, I will calculate the STDEV and AVERAGE for all of the teams from 1941-1945, and all of the Z-Score for each individual team statistic (each individual cell) will come from that range, whether that team is from 1941 or 1945.
What I want if for there to be a rolling calculation that places the year that the team is being calculated at the center. So all of the teams from 1941 would instead be compared to teams from 1939-1943. All of the teams from 1942 would be compared to teams from 1940-1944, etc.
I have tried to just use a formula (let's say it looks something like =((d66-AVERAGE(d2:d162))/STDEV(d2:d162)
that compares, for instance, the 2019 Washington Redskins' rushing attempts in that sheet to teams in the range from the second row to the 161st row, which constitutes all of the teams from 2021-2017. But as I'm sure you can tell, that doesn't work for every cell. Because if I then autofill this formula to compare the next row down, the 2019 Tennessee Titans, they aren't being compared to all of the teams from 2021-2017. They are then being compared to all of the cells from rows 3-162, which does not include the 2021 Washington Football Team and instead includes the 2016 Washington Redskins.
I guess this is what this really comes down to. Is there any way that I can write a formula that uses the fact that in Column A I have labeled each row with the year (or label the rows by year using Named Range) so that I can accomplish this goal of calculating Z-Score by rolling five year data sets?