简体   繁体   中英

How to calculate the average for every 7 colums with a formula?

I want a formula that would calculate the average for the data in a row, but for every 7 columns. So for example =AVERAGE(E25:K25) and then the formula to calculate the next seven =AVERAGE(L25:R25) and then the next seven = AVERAGE(R25:X25) . How can I do that?

Since you seem to have answered your own question I'm guessing that what you would like is some automation. I'm also guessing that copying across would be more useful than say copying down.

In Column K enter:

=IF(MOD(COLUMN(),7)=4,AVERAGE(E25:K25),"")

and drag this across to the right as far as required.

The average is calculated for a continuous sequence of seven values starting in Column K but only displayed every seventh column. K happens to be the eleventh column (Column A being the first) so dividing the column number (obtained from =COLUMN ) by the required range (ie seven values) results in 4 , as derived here by =MOD .

Without fixed references (or anchors, eg $A$1 instead of A1 ) copying across automatically adjusts the results from COLUMN and the range to be averaged. However the IF condition shows the result when the modulus of the column number when divided by 7 is 4 and a blank ( "" ) otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM