0

I need some help to calculate the moving average of the previous n days to date, given that n number is variable due to any given day can contain multiple values insertion (usually from 2 to five). So one specific day can contain several values.

This sheet is specifically related to weight tracking, here is the link: https://docs.google.com/spreadsheets/d/1KhewGXtpElPYtjM4RpA4j2b9fkz17XcA518SPImg4p8/edit?usp=sharing

in the image you can see that for yyyy-mm-dd 2021/07/13 i want the average of the previous 54 and 55 values respectively

Thanks

1 Answers1

0

I see no reason why this wouldn't be possible with a regular AVERAGEIFS() function. Did that not come up during your googling this question?

Here is a sheet created specifically for this question.

And here is the AVERAGEIFS() that I wrote in cell C3 on the MK.Help tab.

=IF(A3<A$3+C$1;;AVERAGEIFS(B:B;A:A;"<="&A3;A:A;">="&A3-C$1))
MattKing
  • 7,373
  • 8
  • 13