Search code examples
google-sheets

How to calculate running average with 1 formula in Google Sheets?


How do you calculate running average with 1 formula in Google Sheets?

In the example below, Data column is given (and dynamically generated/appended); Average_so_far column is desired.

row index Column A [Data] Column B [Average_so_far]
1 1 1
2 1.5 1.25
3 2 1.5
4 1.5 1.5
5 1.25 1.45

How do you generate the values of running averages in 1 formula?


Solution

  • You may try MAP() or BYROW() function. Try-

    =MAP(B2:B6,LAMBDA(x,AVERAGE(B2:INDEX(B2:B,ROW(x)-ROW(B1)))))
    

    enter image description here