Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9764

Can I implement this moving average with missing periods using ARRAYFORMULA?

$
0
0

I have these columns:

  • A person_id
  • B date
  • C cupcakes_eaten

There can be multiple rows with the same person_id and same date.

There can be days with zero rows for a particular person_id (so, missing periods).

I can use this this formula to calculate the 35-day moving average of cupcakes eaten:

=AVERAGEIFS(C:C, A:A, A2, B:B, ">="&B2-35, B:B, "<="&B2)

This works, and I can replicate this to all other rows.

Is there a more elegant way to do this using ArrayFormula so I don't have to replicate it to all the other rows?


Viewing all articles
Browse latest Browse all 9764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>