+ Reply to Thread
Results 1 to 10 of 10

Rolling Average Formula

  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    Wheeling WV
    MS-Off Ver
    Excel 2007
    Posts
    25

    Talking Rolling Average Formula

    I have a spread sheet that has three columns (Midnight, Day and Afternoon shifts). I enter each number each shift produced on that day in their corresponding cell. I need to keep a rolling 30 shift average. This is an overall average and is not shift specific. So for example, when I enter Midnight shifts production, the 30 shift average will give me the average for the past 30 shifts updated automatically up to the last shift that I have entered. Can anyone help me out? I have an example attached..
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Rolling Average Formula

    The data layout is not conducive to easy analysis
    (it would be better from a functional standpoint to have 3 columns per transaction: date|shift|value ordered by date, shift)

    As you have it:

    Please Login or Register  to view this content.
    would work given sample data but it's far from ideal

    that said there will be a simpler way for sure.

    edit:
    an even more convoluted method (not array but Volatile)

    Please Login or Register  to view this content.
    Last edited by DonkeyOte; 09-02-2010 at 10:31 AM.

  3. #3
    Registered User
    Join Date
    03-08-2010
    Location
    Wheeling WV
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Rolling Average Formula

    Donkey, with your suggested way, I don’t follow how to arrange the columns?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Rolling Average Formula

    The formulae should work as they are so I presume you're referring to the suggested revision to layout ?

    When storing data which is to act as source for analysis (ie formulae) it's generally a good idea to think along the lines of database structure.

    In this case you have two key fields per value: Date & Shift

    It follows you have three shifts per date.

    You should therefore store data in the following manner:

    Please Login or Register  to view this content.
    ie Shift becomes a vertical vector - each "transaction" (row) represents a single data point.

    It follows that subsequent last "n" type analysis is fairly straightforward given the values are stored in a consistent manner.

    You can work with the data as you have it but it's slightly more cumbersome to work with down the line.

    The above may appear more cumbersome in terms of data entry but it isn't really and the benefits are likely to outweigh the costs long-term.
    If really nec. you can continue to input as you are and use a load of formulae to transpose the data set for use in later analysis
    Last edited by DonkeyOte; 09-02-2010 at 10:50 AM.

  5. #5
    Registered User
    Join Date
    03-08-2010
    Location
    Wheeling WV
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Rolling Average Formula

    The formulas work great, I was just confused on your suggested layout. Thank You

  6. #6
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Rolling Average Formula

    I tried to understand the formula, so I tested it. Please see the attached file.
    How come the formula gives incorrect result?
    I am just trying to learn.
    Thanks,
    modytrane
    Attached Files Attached Files

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Rolling Average Formula

    My bad - the offset adjustment of -10 is incorrect and should be -9

    Please Login or Register  to view this content.
    I'd probably still opt for the Array ahead of the above mind you (if I couldn't reorganise the data in first instance of course!)

    edit: scrap that - the 9 needs to be 10 where the last active row is incomplete (ie add a MOD test result to the 9)

    Corrected version

    Please Login or Register  to view this content.
    "urgh" springs to mind...
    Last edited by DonkeyOte; 09-02-2010 at 02:34 PM.

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Rolling Average Formula

    A slightly shorter non-array / non-volatile version:

    Please Login or Register  to view this content.
    edit:
    Perhaps worth pointing out though that the Array (post #2) will also account for possibility of numbers not being listed in sequence (blanks interspersed)
    Last edited by DonkeyOte; 09-02-2010 at 03:45 PM.

  9. #9
    Registered User
    Join Date
    03-08-2010
    Location
    Wheeling WV
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Rolling Average Formula

    With the same series of numbers, simply removing one number (and leaving that cell blank) will give you a different answer using the last three formulas you provided Donkey.

    However using the very first formula you provide allowed me to not insert a value (for example Sunday when no production takes place) and it does not affect the 30 shift total.

    Any ideas?

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Rolling Average Formula

    Quote Originally Posted by frank26003
    using the very first formula you provide allowed me to not insert a value (for example Sunday when no production takes place) and it does not affect the 30 shift total.
    Per the edit in my last post:

    Quote Originally Posted by D.O
    Perhaps worth pointing out though that the Array (post #2) will also account for possibility of numbers not being listed in sequence (blanks interspersed)
    In the case of the Array (the very first formula provided) - if the blank is to be counted in the Averages then I would suggest you enter 0 for those shifts (greater transparency IMO).

    Quote Originally Posted by frank26003
    simply removing one number (and leaving that cell blank) will give you a different answer using the last three formulas you provided Donkey
    A few formulae posted were flawed - the below should all return the same results (point re: blanks excepted)

    Please Login or Register  to view this content.
    I would be inclined to use the last depending on the issue of interspersed blanks - if such values shall exist and are to be ignored then use the Array.
    Last edited by DonkeyOte; 09-03-2010 at 03:51 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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