1 may12 271 271 271 SUM(02/05/2011 TO 01/05/2012) / 366
2 may12 311 582 291 SUM(03/05/2011 TO 02/05/2012) / 366
3 may12 328 910 303 SUM(04/05/2011 TO 03/05/2012) / 366
4 may12 338 1248 312 SUM(05/05/2011 TO 04/05/2012) / 366
5 may12 309 1557 311 SUM(06/05/2011 TO 05/05/2012) / 366
6 may12 295 1852 308 SUM(07/05/2011 TO 06/05/2012) / 366
7 may12 341 2193 313 SUM(08/05/2011 TO 07/05/2012) / 366
8 may12 333 2526 316 SUM(09/05/2011 TO 08/05/2012) / 366
....
31 may12 332 9953 321 SUM(01/06/2011 TO 31/05/2012) / 366
1 jun12 345 345 345 SUM(02/06/2011 TO 01/06/2012) / 366
2 jun12 310 655 328 SUM(03/06/2011 TO 01/06/2012) / 366
and I need to calculate a moving average (Sum of 01/05/2011 to 30/04/2012) / 366 (for leap year, but when in February 2012 is out of range should be divided by 365), and as the day of the current month incorporates it must subtract the last of 2011. For example, on 01/05/2012, the formula must be changed to: Sum (of 02/05/2011 to 01/05/2012 ) / 366; The day 02/05/2012 the formula should be changed to Sum(of 03/05/2011 to 05/02/2012) / 366...