excel averaging every 10 rows

前端 未结 1 972
不思量自难忘°
不思量自难忘° 2020-12-28 23:59

I have a big data set which has about 9000 rows. I have a few variables for every year from 1960 onwards, and I need to average them in ten year bins. So I have something li

相关标签:
1条回答
  • 2020-12-29 00:33

    Suppose your data starts from A1. Try this one in B1:

    =AVERAGE(INDEX(A:A,1+10*(ROW()-ROW($B$1))):INDEX(A:A,10*(ROW()-ROW($B$1)+1)))

    and drag it down.

    • in B1 it would be =AVERAGE(A1:A10)
    • in B2 it would be =AVERAGE(A11:A20)
    • in B3 it would be =AVERAGE(A21:A30)

    and so on.

    General case

    If your data starts from An (where n is 2,3,4,...), use this one:

    =AVERAGE(INDEX(A:A,n+10*(ROW()-ROW($B$1))):INDEX(A:A,n-1+10*(ROW()-ROW($B$1)+1))

    where you should change n to 2,3,4,...

    0 讨论(0)
提交回复
热议问题