• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to find 3 month rolling averages by day, with offset data?

blackdays

New Member
Hi, I hope someone can help. I have been pulling what little hair I have out...


I have the date from 01/06/13 - 01/06/14 (one year) with hourly data to be entered as in the format below. I need to find the average of today over the course of a year and also the rolling 3 monthly averages.

Sample Data below:

DATE TIME RESULT

13/06/2013 04:00 61.00

05:00 60.00

06:00 66.00

07:00 68.00

08:00 66.00

09:00 67.00

10:00 65.00

11:00 62.00

Shift Avg 64.86

12:00 63.00

13:00 68.00

14:00 55.00

15:00 66.20

16:00 75.20

17:00 77.00

18:00 79.00

19:00 65.00

Shift Avg 68.55

20:00 65.00

21:00 66.00

22:00 87.00

23:00 56.00

00:00 54.00

01:00 59.00

02:00

03:00

Shift Avg 64.50

Daily Avg 66.16

14/06/2013 04:00

05:00

etc.


The total historical averages were relatively easy with "=IF(ISERROR(AVERAGE(OFFSET(dataset1,28-1,0))),"",AVERAGE(OFFSET(dataset1,28-1,0)))"


How do I ask excel to find the day of the week (7-day) and average all of the daily avgs?

I'm guessing using match, index and offset with the average function, but am at a loss?

Thanks for the help!
 
Hi, blackdays!


First of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.


As a starting point I'd recommend you to read the green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).


Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.


Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.


And about questions in general...


If you haven't performed yet the search herein, try going to the topmost right zone of this page (Custom Search), type the keywords used in Tags field when creating the topic or other proper words and press Search button. You'd retrieve many links from this website, like the following one(s) -if any posted below-, maybe you find useful information and even the solution. If not please advise so as people who read it could get back to you as soon as possible.


And about this question in particular...


Give a look at this file:

https://dl.dropboxusercontent.com/u/60558749/How%20to%20find%203%20month%20rolling%20averages%20by%20day%2C%20with%20offset%20data_%20%28for%20blackdays%20at%20chandoo.org%29.xlsx


If you want to rebuild the table into a new worksheet as with this design:

-----

[pre]
Code:
Date		Month	Day of Week	Shift	Time	Result
01/06/2013	6	7		1	04:00	61
[/pre]
-----

so as to play easily with average formulas do this:


A2: =INDICE(Hoja1!A:A;(ENTERO((FILA()-1+23)/24)-1)*28+2;1) -----> in english: =INDEX(Hoja1!A:A,(INT((ROW()-1+23)/24)-1)*28+2,1)


B2: =MES(A2) -----> in english: =MONTH(A2)


C2: =DIASEM(A2) -----> in english: =WEEKDAY(A2)


D2: =RESIDUO(ENTERO((FILA()-1+7)/8)+2;3)+1 -----> in english: =MOD(INT((ROW()-1+7)/8)+2,3)+1


E2: =INDICE(Hoja1!B:B;FILA()+ENTERO((FILA()-1+23)/24)-1+ENTERO((FILA()-1+7)/8)-1;1) -----> in english: =INDEX(Hoja1!B:B,ROW()+INT((ROW()-1+23)/24)-1+INT((ROW()-1+7)/8)-1,1)


Copy E2 to F2. Copy A2:F2 thru row 8761 (364*24+1).


Then you have all the elements to easily perform any calculations regarding shifts, dates, weekdays, months, ... The only restriction is that you shouldn't use subtotals because of performance issues.


Regards!
 
Back
Top