+ Reply to Thread
Results 1 to 3 of 3

Rolling Average Output to an Array

  1. #1
    Registered User
    Join Date
    12-30-2012
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    36

    Rolling Average Output to an Array

    Hi,

    I have several thousand 19-day time series and am trying to find the maximum 5-day rolling average for each series. I would like to do this in one array formula. Is this possible?

    As an example, the time series below would take the Value column and output the max average of 166.67, without a need for a third column.

    Day Value 5-Day moving Average
    1 122.97
    2 153.55
    3 156.53
    4 96.41
    5 152.11 136.31
    6 168.16 145.35
    7 183.26 151.29
    8 164.05 152.80
    9 136.58 160.83
    10 181.77 166.76
    11 154.01 163.93
    12 156.27 158.54
    13 129.78 151.68
    14 108.45 146.06
    15 180.08 145.72
    16 181.39 151.19
    17 154.78 150.90
    18 95.16 143.97
    19 180.88 158.46
    Max Average 166.76

  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: Rolling Average Output to an Array

    Try this...

    Data Range
    A
    B
    C
    D
    1
    ------
    ------
    ------
    ------
    2
    122.97
    166.764
    3
    153.55
    4
    156.53
    5
    96.41
    6
    152.11
    136.31
    7
    168.16
    145.35
    8
    183.26
    151.29
    9
    164.05
    152.8
    10
    136.58
    160.83
    11
    181.77
    166.76
    12
    154.01
    163.93
    13
    156.27
    158.54
    14
    129.78
    151.68
    15
    108.45
    146.06
    16
    180.08
    145.72
    17
    181.39
    151.19
    18
    154.78
    150.9
    19
    95.16
    143.97
    20
    180.88
    158.46


    This array formula** entered in D2:

    =MAX(SUBTOTAL(1,OFFSET(A2,ROW(A2:A16)-ROW(A2),,5)))

    ** 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.

    Note how the range in the ROW function ends 5 cells from the actual end of data.

    We can probably calculate that directly into the formula if need be.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    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
    30,973

    Re: Rolling Average Output to an Array

    To get the MAXIMUM of each series

    in D1

    =MAX(OFFSET($B$1,(ROWS($1:1)-1)*19+1,,19))

    Copy down to give you the max of each 19 day series.

+ 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] Rolling Average
    By T15K in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-14-2013, 06:38 PM
  2. [SOLVED] 5 Day rolling average
    By spazzcdnm in forum Excel General
    Replies: 3
    Last Post: 07-17-2012, 04:27 PM
  3. Rolling average
    By gth8991 in forum Excel General
    Replies: 3
    Last Post: 10-03-2011, 11:57 AM
  4. Rolling Average
    By Skee in forum Excel General
    Replies: 9
    Last Post: 04-19-2009, 02:39 PM
  5. rolling average
    By William Okumu in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-25-2006, 10:49 AM
  6. [SOLVED] Rolling 3 mth Average
    By dallin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-22-2005, 12:15 PM
  7. Rolling Average
    By Bearcats_85 in forum Excel General
    Replies: 7
    Last Post: 07-19-2005, 11:05 AM
  8. average-whole array output
    By Tajin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2005, 10:06 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