+ Reply to Thread
Results 1 to 17 of 17

Creating a rolling average by using offset?

  1. #1
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Cool Creating a rolling average by using offset?

    Hello!

    I am creating a payroll forecast spreadsheet that reflects back on the rolling average of the prior 6 weeks. Each new week the last week is dropped off and the new week should be added in.

    My formula at the moment is

    =AVERAGE(IF(WEEKDAY($C$31:$C$75)='Dash Data>>'!$D$2,D$31:D$75))

    I am trying to work out how I can plus 7 to the $31$ / $75$ by possibly using OFFSET? The columns will always remain the same we are dropping down the sheet.

    I have kept all the historical information in there as we use for future year comparisons.

    if anyone has a sneaky trick to use that would be great!!

    Chantelle
    Attached Files Attached Files
    Last edited by Chon1978; 02-08-2023 at 10:59 PM. Reason: Load an attachment

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,831

    Re: Creating a rolling average by using offset?

    I'm not clear on where you're going 6 weeks back from, but let's just say you put whatever date you want to go back from in cell P13, would this formula work? (Change the P13 to whatever date you want to go to)

    =AVERAGEIFS($D$6:$D$222,C6:C222,"<="&P13,C6:C222,">="&P13-41)

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Creating a rolling average by using offset?

    Some expected answers would help!!

    =IFERROR(AVERAGE(TAKE(FILTER(D$6:D$1000,(WEEKDAY($C$6:$C$1000)='Dash Data>>'!$D1)*(D$6:D$1000<>"")),-6)),"")

    copied across and dnown for DR1 & DR2. Similar for DR3.

    See file.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Creating a rolling average by using offset?

    NB> I put Sunday at the bottom of the day list, to make formula copying easier....

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Creating a rolling average by using offset?

    All are ARRAY formulas.
    IN Q6 copied up to Column X
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In Y6 copied to column Z
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Re: Creating a rolling average by using offset?

    Oh wow some amazing suggestions here.

    I haven't used the filter formula before.

    I will attempt all of them!

    Thank you Chantelle

  7. #7
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Re: Creating a rolling average by using offset?

    How does this automatically move down to the following week though when I enter data for the week ending 12/02?
    I am unsure how the offset knows to move down 7?
    What would I be entering to trigger the formula to drop the first week and add the newest 6th week?
    Apologies if this is a silly response?

  8. #8
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Re: Creating a rolling average by using offset?

    I think this would work in principle i would need to add in the selection of all MONDAYS though (in the average of weekday formula)

  9. #9
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Re: Creating a rolling average by using offset?

    I think this could be the simplest but I need it to return the average of all the MONDAYS in that six week block and all the TUESDAYS. I will play around trying to insert the weekday component.

  10. #10
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,831

    Re: Creating a rolling average by using offset?

    You are not addressing anyone, so we don't know who the questions are for.

    But I've looked at this closer and see where my formula is not what I thought you were looking for
    Last edited by Gregb11; 02-09-2023 at 07:28 PM.

  11. #11
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Re: Creating a rolling average by using offset?

    Hi Greg,

    I thought I was replying directly to the person but unfortunately it just did a generic reply without referencing anyone, my apologies.

    I have tried all formulas and they are excellent but I am still not sure they are capturing what I need exactly.

    I have reattached a spreadsheet with everyone's brilliants suggestions but they still don't seem to be able to hit it.

    I like the idea of having a field in P13 which tells me how far back I need to go - I am struggling though in what formula to put in for it to automatically take a range less 41 days from the date!!!

    Thanks Chantelle
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,831

    Re: Creating a rolling average by using offset?

    I think I understand now. This formula gives all the same answers that you have. It's based on the END DATE being in cell P13, so however you want to determine the end date (6 weeks back from when), you can replace where you see P13.

    This goes in cell Q6, then copy down and across:

    =AVERAGE(FILTER(D$6:D$222,($C$6:$C$222<=$P$13)*($C$6:$C$222>=$P$13-44)*(WEEKDAY($C$6:$C$222)='Dash Data>>'!$D10)))

  13. #13
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Thumbs up Re: Creating a rolling average by using offset?

    This works perfectly!!

    Thank you I would have absolutely struggled to get this formula.

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Creating a rolling average by using offset?

    Greg's contains a slight error. It's giving an average of 7 weeks, not 6.

    This is clearer:

    =LET(C,$C$6:$C$1000,D,D$6:D$1000,V,6,End,$P$13,IFERROR(AVERAGE(TAKE(FILTER(D,(WEEKDAY(C)='Dash Data>>'!$D10)*(D<>"")*(C<=End)),-V)),""))

    RED defines the number of weeks.

    Greem defines the end date (which I didn't take into account the first time round... that's why expected answers help).
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    02-08-2023
    Location
    Australia
    MS-Off Ver
    2301
    Posts
    13

    Re: Creating a rolling average by using offset?

    Thanks Glenn

    I reconciled to the days and noted there was a slight difference which was fixed for F-S if I made the # 41 not 44.

    You are all fantastic.

    I think I need some more training on these formulas - I have never used a LET formula before combined with a filter. Just reminds you how powerful excel is as a spreadsheet.

    If you ever have the time to explain this formula to me it would be amazing. I am unsure what the V is?!

    Thanks Chantelle

  16. #16
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,831

    Re: Creating a rolling average by using offset?

    And I think that's because of the ambiguity of PRIOR 6 weeks. The OP's answers were going back 7 weeks as well, so I assume they are looking for the current week, plus 6 weeks prior to this week. Either way, right, they'll have to adjust the 6 in your formula, or the 44 in mine.

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Creating a rolling average by using offset?

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    [/COLOR]

    Green filter column D
    Cyan where these criteria are met Weekday = Mon, etc,,, value is non-blank, date <= END
    Blue take the LAST 6 values (- V for last six)
    Purple. Return an average

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to use AVERAGEIFS and OFFSET to get rolling average
    By Trader3000 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-18-2022, 09:38 AM
  2. offset formula to calculate rolling average
    By fruitloop44 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 08-17-2022, 05:33 AM
  3. Rolling 3-Month Sum with Offset
    By mvparker79 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 07-01-2021, 01:57 PM
  4. Sumproduct W/Offset to Create a Rolling Average for Filtered Cells
    By gtnewberry in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-05-2017, 11:41 AM
  5. Rolling average using offset that ignores blanks
    By jd33a in forum Excel General
    Replies: 1
    Last Post: 09-07-2017, 05:14 PM
  6. [SOLVED] Creating a rolling average
    By Bradleypike in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 08-14-2017, 10:47 AM
  7. Rolling Average:use INDEX and OFFSET
    By SKAh in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-18-2007, 09:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1