+ Reply to Thread
Results 1 to 4 of 4

Calculate average of the last valid 30 days

  1. #1
    Registered User
    Join Date
    06-10-2015
    Location
    Denver, CO
    MS-Off Ver
    2011
    Posts
    2

    Calculate average of the last valid 30 days

    I need to calculate a 30 day rolling average.

    The difficulty lies in the fact that a day must meet a certain criteria to be considered in the average. If a day does not meet the criteria, the calculation needs to perform as if that day did not exist.

    The range in the average function needs to adjust to ultimately average 30 valid days.

    Any ideas?

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Calculate average of the last valid 30 days

    Not enough info. Be very specific.

    What if there aren't 30 entries that meet the condition(s)?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    06-10-2015
    Location
    Denver, CO
    MS-Off Ver
    2011
    Posts
    2

    Re: Calculate average of the last valid 30 days

    Thanks, Tony.

    I've attached a sample file.

    I am calculating the 30 day rolling average of mercury emissions in a power plant. If the power plant is not generating that day, the mercury number can be ignored. The average needs to then find the last valid 30 days and return that average. Example 30 day rolling avg.xlsx

    Let me know if you need more information.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Calculate average of the last valid 30 days

    Try this array formula**:

    =AVERAGE(IF(ROW(B2:B40)>=LARGE(IF(B2:B40="Yes",ROW(B2:B40)),30),IF(B2:B40="Yes",C2:C40)))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

+ 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. [SOLVED] formula which can calculate last 7 days average
    By kiany406 in forum Excel General
    Replies: 1
    Last Post: 05-22-2015, 05:03 PM
  2. [SOLVED] How to calculate an average for all days within a certain month
    By consulttk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-03-2012, 11:37 AM
  3. Code to calculate the last 720 valid hours THEN give a rollin average of the data
    By joeyheaf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-03-2012, 02:39 PM
  4. Calculate Average days
    By mrcois in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2010, 02:07 AM
  5. Formula to calculate average days to ship
    By maacmaac in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-29-2010, 08:49 PM

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