简体   繁体   中英

Dynamically Average in Cell (Excel 2016)

I have problem with dynamically average calcuation.

在此处输入图片说明

...after adding (I change Average manually)

在此处输入图片说明

In my Excel file I have users with some values and I'm every month adding new values and there is also Average that must increase. Now I edit this manually but I want to do that automatically. Is it possible? How should be the formula for this?

Note that I cannot move cells.

First of all move the column with the average to a place where you don't need to move it anymore. Probably P column if you need to get all months in there.

Then in the P2 cell add this formula

=SUM(D2:O2)/COUNT(D2:O2)  

This will first sum the range and then divide by the number of entries you have in the range.

However, this part: also Average that must increase is nothing that a formula can handle.
It will only calculate the average, sometimes it may increase and sometimes it will decrease.

As stated above, you should move the average calculation else where.

Another approach is to create a named ranges.

For John, we will use following formula for named range definition and call it JohnAvg , this is generic formula for dynamic range, it will expand for the defined line automatically, considering you have only the months data you want to average there:

=$D$2:INDEX($2:$2;COUNTA($2:$2))

Then, the formula for calculating John's average is:

=AVERAGE(JohnAvg)
=AVERAGE(OFFSET(F2,0,4-COLUMN(),1,COLUMN()-4))

(Written to start in cell F2 )

This will use OFFSET to create a Range that starts in Column 4 (D) and extends until the Column before the Cell that the formula is written in.

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