+ Reply to Thread
Results 1 to 4 of 4

Dynamic lookback period/N days in Excel...? Possible?

  1. #1
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Dynamic lookback period/N days in Excel...? Possible?

    Hi all,

    I have a general problem that I'm curious if there's a smart way to solve in Excel.

    Basically, I have a lot of data that I'm analyzing and I'm interested in exploring various lookback periods when calculating averages, distributions, maximum/minimum and other statistical values. For instance, I might want to have a 5 day look back period, a 20 day, 60 day or the entire sample.

    Would there be an (easy) way to set up my sheets such that the lookback period can be dynamic, i.e., based on a value in a single cell or similar?

    I'm attaching one sheet of stuff I'm looking at. In this sheet, I actually created charts/boxes for all the various lookback periods of interest. So, that's one way to do it, but I feel it can be a little overwhelming.

    I have a lot of other sheets with similar data to create and I was wondering if it'd be easier to set it up dynamically if possible.

    Thanks very much in advance!

    Best,

    Elijah
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Dynamic lookback period/N days in Excel...? Possible?

    Data Validation in some cell (A1, below) using list: 5,10.15,20,40,60,120,240
    Dynamic formulas:
    Average =FLOOR.MATH(AVERAGE(OFFSET(Tabell1[@Range],0,0,$A$1)),0.25,0)
    Median =FLOOR.MATH(MEDIAN(OFFSET(Tabell1[@Range],0,0,$A$1)),0.25,0)
    Mode =MODE(OFFSET(Tabell1[@Range],0,0,$A$1))
    Maximum =MAXA(OFFSET(Tabell1[@Range],0,0,$A$1))
    Minimum =MINA(OFFSET(Tabell1[@Range],0,0,$A$1))
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    03-31-2010
    Location
    Norway
    MS-Off Ver
    Excel 365
    Posts
    632

    Re: Dynamic lookback period/N days in Excel...? Possible?

    Hi, protonLeah,

    That's great! Thanks a lot!

    I just tested the Average and it seems to work, although I think the reference value in OFFSET should be A12 and not @Range, right?

    Now that this seems to be possible fairly easily, the next question is if I can achieve the same with a chart? Such that I can have one chart that updates according to the value in A1?

    Maybe this can be done simply by updating my Frequency count using the OFFSET function?

    EDIT: It does seem like it, yes!

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Dynamic lookback period/N days in Excel...? Possible?

    Yes it should have been A12.

+ 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] 24 Hour Lookback
    By teststrip in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-19-2017, 08:51 AM
  2. [SOLVED] Days between a period!
    By Keibri in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-04-2016, 06:38 PM
  3. [SOLVED] Need to count how many days in week period, if period starts mid week?
    By mrsdeapsleap in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-18-2016, 03:29 AM
  4. Replies: 0
    Last Post: 06-11-2015, 03:12 AM
  5. How to set trial period for 30 days using excel VBA
    By mizzlyla in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-21-2014, 04:38 AM
  6. Replies: 6
    Last Post: 05-10-2012, 07:33 AM
  7. Replies: 1
    Last Post: 11-09-2010, 08:02 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