问题
I am trying to autofill a formula in Excel. What I mean by that is that I'm trying to have the average of the first 26 rows of a column, then the average of the next 26 rows of the same column, and so on.
I have a pretty large data file, so I can't do it manually. The idea is to scale a series of data points to data points per second, and I have about 26 data points per second.
So far I have already tried doing it manually, and just dragging the formulas down, which doesn't work since the average goes from row 2 to 27 instead of from row 26 to 52, for example.
回答1:
Your formula for first row to autofill directly can be:
=AVERAGE(OFFSET(A$1,26*(ROW(1:1)-1),0,26))
回答2:
With data in column A, in B1 enter:
=AVERAGE(INDIRECT("A" & 26*(ROW()-1)+1 & ":A" & ROW()*26))
and copy downwards. This is equivalent to inserting:
=SUM(A1:A26)
=SUM(A27:A52)
=SUM(A53:A78)
=SUM(A79:A104)
=SUM(A105:A130)
=SUM(A131:A156)
=SUM(A157:A182)
but without having to adjust each formula.
回答3:
This avoids volatile function like INDIRECT and OFFSET
In B1,
=AVERAGE(INDEX(A:A,(ROW(1:1)-1)*26 + 1):INDEX(A:A,(ROW(1:1)-1)*26 + 26))
The data is in column A
The *26
is the spacing
The + 1
is the first cell that has the data, so if the data starts in row two change it to + 2
The + 26
is the last row of the first group, so again if the data starts on row 2 then it should change to + 27
来源:https://stackoverflow.com/questions/44745800/autofilling-a-formula-is-that-possible