Formula to calculate automatically progressive average

vladimiratanasiu

Active Member
Joined
Dec 17, 2010
Messages
347
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hello!

I have a situation with monthly costs. I need a formula to calculate and show automatically the average of all costs at some point (as it's shown in the attached table), each time a new value is inserted and excluding the annual totals. Thank you!
Book1.xlsx
ABCD
1YearMonthCostMedium cost
2201704/01/201734.8334.83
35/1/20177253.42
406/01/201774.7760.53
507/01/201777.7464.84
608/01/201776.567.17
709/01/201767.7467.26
810/01/2017130.1176.24
911/01/2017183.4489.64
1012/01/2017189.56100.74
11Total906.69
12201801/01/2018189.56109.63
1302/01/2018169.62115.08
1403/01/2018177.41120.27
1504/01/2018128.08120.87
1605/01/2018132.35121.69
1706/01/2018128.08122.12
1807/01/2018132.35122.76
1908/01/2018132.35123.32
2009/01/2018113.2122.76
2110/01/201878.29120.42
2211/01/201875.77118.19
2312/01/201878.29116.29
24Total1535.35
25201901/01/201978.29114.56
2602/01/201970.72112.65
2703/01/201971.48110.94
2804/01/201964.42109.08
2905/01/201966.57107.44
3006/01/201964.42105.85
3107/01/2019
3208/01/2019
3309/01/2019
3410/01/2019
3511/01/2019
3612/01/2019
37Total415.9
Sheet1
Cell Formulas
RangeFormula
D2D2=AVERAGE(C2)
D3:D10D3=AVERAGE($C$2:C3)
C11C11=SUM(C2:C10)
D12D12=AVERAGE($C$2:$C$10,$C$12)
D13:D23D13=AVERAGE($C$2:$C$10,$C$12:C13)
C24,C37C24=SUM(C12:C23)
D25D25=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25)
D26:D30D26=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25:C26)
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
=IF(B2="total","",AVERAGEIFS($C$2:C2,$B$2:B2,"<>"&"Total"))


Book1
ABCDEF
1YearMonthCostMedium cost
220174273934.8334.8334.83
31/5/177253.41553.415
44274174.7760.5333333360.5333333
54274277.7464.83564.835
64274376.567.16867.168
74274467.7467.2633333367.2633333
842745130.1176.2414285776.2414286
942746183.4489.6412589.64125
1042747189.56100.7433333100.743333
11Total906.69 
12201843101189.56109.625109.625
1343102169.62115.0790909115.079091
1443103177.41120.2733333120.273333
1543104128.08120.8738462120.873846
1643105132.35121.6935714121.693571
1743106128.08122.1193333122.119333
1843107132.35122.75875122.75875
1943108132.35123.3229412123.322941
2043109113.2122.7605556122.760556
214311078.29120.42120.42
224311175.77118.1875118.1875
234311278.29116.287619116.287619
24Total1535.35 
2520194346678.29114.5604545114.560455
264346770.72112.6543478112.654348
274346871.48110.93875110.93875
284346964.42109.078109.078
294347066.57107.4430769107.443077
304347164.42105.8496296105.84963
314347266.57104.4467857104.446786
324347366.57103.1406897103.14069
334347466.29101.9123333101.912333
344347569.79100.876129100.876129
354347667.5499.83437599.834375
364347769.7998.9239393998.9239394
37Total822.45 
Sheet1
Cell Formulas
RangeFormula
D2D2=AVERAGE(C2)
D3:D10D3=AVERAGE($C$2:C3)
C11C11=SUM(C2:C10)
D12D12=AVERAGE($C$2:$C$10,$C$12)
D13:D23D13=AVERAGE($C$2:$C$10,$C$12:C13)
C24,C37C24=SUM(C12:C23)
D25D25=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25)
D26:D36D26=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25:C26)
F2:F37F2=IF(B2="total","",AVERAGEIFS($C$2:C2,$B$2:B2,"<>"&"Total"))
 
Upvote 0
=IF(B2="total","",AVERAGEIFS($C$2:C2,$B$2:B2,"<>"&"Total"))


Book1
ABCDEF
1YearMonthCostMedium cost
220174273934.8334.8334.83
31/5/177253.41553.415
44274174.7760.5333333360.5333333
54274277.7464.83564.835
64274376.567.16867.168
74274467.7467.2633333367.2633333
842745130.1176.2414285776.2414286
942746183.4489.6412589.64125
1042747189.56100.7433333100.743333
11Total906.69 
12201843101189.56109.625109.625
1343102169.62115.0790909115.079091
1443103177.41120.2733333120.273333
1543104128.08120.8738462120.873846
1643105132.35121.6935714121.693571
1743106128.08122.1193333122.119333
1843107132.35122.75875122.75875
1943108132.35123.3229412123.322941
2043109113.2122.7605556122.760556
214311078.29120.42120.42
224311175.77118.1875118.1875
234311278.29116.287619116.287619
24Total1535.35 
2520194346678.29114.5604545114.560455
264346770.72112.6543478112.654348
274346871.48110.93875110.93875
284346964.42109.078109.078
294347066.57107.4430769107.443077
304347164.42105.8496296105.84963
314347266.57104.4467857104.446786
324347366.57103.1406897103.14069
334347466.29101.9123333101.912333
344347569.79100.876129100.876129
354347667.5499.83437599.834375
364347769.7998.9239393998.9239394
37Total822.45 
Sheet1
Cell Formulas
RangeFormula
D2D2=AVERAGE(C2)
D3:D10D3=AVERAGE($C$2:C3)
C11C11=SUM(C2:C10)
D12D12=AVERAGE($C$2:$C$10,$C$12)
D13:D23D13=AVERAGE($C$2:$C$10,$C$12:C13)
C24,C37C24=SUM(C12:C23)
D25D25=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25)
D26:D36D26=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25:C26)
F2:F37F2=IF(B2="total","",AVERAGEIFS($C$2:C2,$B$2:B2,"<>"&"Total"))
Thank you for your prompt answer! Your formula is available only by adjusting it manually. However, it doesn't move down automatically, in line with other new values inserted. Could you adjust it, to consider these specific conditions? Thank you!
Book1.xlsx
ABCDE
1YearMonthCostMedium cost
2201704/01/201734.8334.8334.83
35/1/20177253.4253.415
406/01/201774.7760.5360.53333
507/01/201777.7464.8464.835
608/01/201776.567.1767.168
709/01/201767.7467.2667.26333
810/01/2017130.1176.2476.24143
911/01/2017183.4489.6489.64125
1012/01/2017189.56100.74100.7433
11Total906.69 
12201801/01/2018189.56109.63109.625
1302/01/2018169.62115.08115.0791
1403/01/2018177.41120.27120.2733
1504/01/2018128.08120.87120.8738
1605/01/2018132.35121.69121.6936
1706/01/2018128.08122.12122.1193
1807/01/2018132.35122.76122.7588
1908/01/2018132.35123.32123.3229
2009/01/2018113.2122.76122.7606
2110/01/201878.29120.42120.42
2211/01/201875.77118.19118.1875
2312/01/201878.29116.29116.2876
24Total1535.35 
25201901/01/201978.29114.56114.5605
2602/01/201970.72112.65112.6543
2703/01/201971.48110.94110.9388
2804/01/201964.42109.08109.078
2905/01/201966.57107.44107.4431
3006/01/201964.42105.85105.8496
3107/01/201955104.03
3208/01/201944101.96
3309/01/2019
3410/01/2019
3511/01/2019
3612/01/2019
37Total514.9 
Sheet1
Cell Formulas
RangeFormula
D2D2=AVERAGE(C2)
D3:D10D3=AVERAGE($C$2:C3)
C11C11=SUM(C2:C10)
D12D12=AVERAGE($C$2:$C$10,$C$12)
D13:D23D13=AVERAGE($C$2:$C$10,$C$12:C13)
C24,C37C24=SUM(C12:C23)
E37,E2:E30E2=IF(B2="total","",AVERAGEIFS($C$2:C2,$B$2:B2,"<>"&"Total"))
D25D25=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25)
D26:D32D26=AVERAGE($C$2:$C$10,$C$12:$C$23,$C$25:C26)
 
Upvote 0
=IF(OR(B2="total",C2=""),"",AVERAGEIFS($C$2:C2,$B$2:B2,"<>"&"Total"))
and copy down as far as you want
 
Upvote 0
Solution

Forum statistics

Threads
1,223,881
Messages
6,175,159
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top