Average Of Day Before Value

pilot330

Board Regular
Joined
Feb 19, 2004
Messages
57
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need a formula for COL C, that will put the average of the previous days values from COL B.
For example the average for 07/07/2015 in COL A, was 46 in COL B. I need to put that value in COL C., and so on down through the spreadsheet.

Book2
ABC
1Dateprb^2Average For Day Before
206/07/201525.00
307/07/201540.50
407/07/20150.00
507/07/201576.56
607/07/201566.94
708/07/201511.1146.00
808/07/201569.4446.00
908/07/20159.0046.00
1009/07/201544.44
1110/07/20150.83
1210/07/201511.11
1310/07/201518.37
1411/07/201558.48
1511/07/20154.94
1611/07/201556.25
1711/07/201573.47
1815/07/201514.06
1915/07/20152.04
2016/07/201511.11
2116/07/201573.47
2217/07/20150.00
2317/07/20150.00
2418/07/201525.00
2518/07/201551.02
2620/07/201564.00
2720/07/201576.56
2821/07/201521.30
2921/07/20150.00
3022/07/201585.21
3122/07/201511.11
3222/07/201525.00
3322/07/20150.00
Sheet1


Thanks,
Paul
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
This works but based on your example you may want to round the results.
Book1
ABC
1Dateprb^2Average For Day Before
206/07/2015250
307/07/201540.4958677725
407/07/2015025
507/07/201576.562525
607/07/201566.9421487625
708/07/201511.1111111146.00012913
808/07/201569.4444444446.00012913
908/07/2015946.00012913
1009/07/201544.4444444429.85185185
1110/07/20150.82644628144.44444444
1210/07/201511.1111111144.44444444
1310/07/201518.3673469444.44444444
1411/07/201558.4775086510.10163478
1511/07/20154.93827160510.10163478
1611/07/201556.2510.10163478
1711/07/201573.4693877610.10163478
1815/07/201514.062548.283792
1915/07/20152.04081632748.283792
2016/07/201511.111111118.051658163
2116/07/201573.469387768.051658163
2217/07/2015042.29024943
2317/07/2015042.29024943
2418/07/2015250
2518/07/201551.020408160
2620/07/20156438.01020408
2720/07/201576.562538.01020408
2821/07/201521.3017751570.28125
2921/07/2015070.28125
3022/07/201585.2071005910.65088757
3122/07/201511.1111111110.65088757
3222/07/20152510.65088757
3322/07/2015010.65088757
Sheet1
Cell Formulas
RangeFormula
C2:C33C2=IFERROR(AVERAGEIFS(B:B,A:A,MAXIFS(A:A,A:A,"<"&A2)),0)
 
Upvote 0
Thanks very much, works perfectly.
Would it be possible to modify the formula so that it could return the average X number of previous days. Lets say I wanted to get the previous 7 days, or 114 days....
Thanks again!
 
Upvote 0
Lets say I wanted to get the previous 7 days
If you mean previous 7 calendar days then try
=IFERROR(AVERAGEIFS(B:B,A:A,"<"&A2,A:A,">="&(A2-7)),"")

Noting that there are gaps in the dates, if you mean the last 7 days with entries then I think that it might need some creative thinking.
 
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,811
Members
449,127
Latest member
Cyko

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