+ Reply to Thread
Results 1 to 6 of 6

Calculate a rolling average over columns

  1. #1
    Registered User
    Join Date
    05-29-2015
    Location
    Painesville, OH
    MS-Off Ver
    2007
    Posts
    23

    Calculate a rolling average over columns

    Please see the attached example. Each row represents weekly unit sold for a specific SKU we sell (not in the example). I need to get a rolling 12 week average every time a new week is not 0.

    In this example =AVERAGE(J4:U4) results in 932 which is great but when column V is updated with a values > 0 then we need the average to roll to columns K thru V for each row. This needs to occur for each of the 52 weeks.


    Tried incorporating OFFSET in the AVERAGE calculation but can't get this to work. HELP!!!!
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Calculate a rolling average over columns

    =AVERAGE(OFFSET(A4:L4,0,MAX(IF(($U$4:$AZ$16<>0),COLUMN($U$4:$AZ$16)))-11))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Calculate a rolling average over columns

    This should do the trick
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Confirm with [ctrl][shift][enter]
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Calculate a rolling average over columns

    I believe previous formula should be:

    =AVERAGE(OFFSET(A4:L4,0,MAX(IF(($U$4:$AZ$16<>0),COLUMN($U$4:$AZ$16)))-12))

    This gives same results as your sample.

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Calculate a rolling average over columns

    You know, I tried 12 and didn't get the result I was aiming for and changed it to 11.

    Maybe I'm just crazies today. I blame the stones.

    Also, change the U4's to L4's.
    Last edited by daffodil11; 05-29-2015 at 04:20 PM.

  6. #6
    Registered User
    Join Date
    05-29-2015
    Location
    Painesville, OH
    MS-Off Ver
    2007
    Posts
    23

    Re: Calculate a rolling average over columns

    Never ever would I have figured this out! Works GREAT. Thank you so much!!!!

+ 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. formula in Excel to calculate rolling daily average of sales total by date
    By Geekgurl in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-17-2014, 05:30 PM
  2. [SOLVED] To calculate the average of the ratios between two columns
    By BNCOXUK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-26-2013, 07:37 AM
  3. [SOLVED] How to calculate a rolling average over X periods
    By Johnex777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-03-2013, 10:37 AM
  4. Rolling average across columns with criteria
    By Lee1800 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-07-2008, 10:48 AM
  5. Looking-up Columns w/calc'd Values ONLY to Calculate Average
    By sony654 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-21-2006, 01:25 AM

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