+ Reply to Thread
Results 1 to 4 of 4

Moving/trailing standard deviation (multiple conditions?)

  1. #1
    Registered User
    Join Date
    09-14-2015
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    2007
    Posts
    2

    Moving/trailing standard deviation (multiple conditions?)

    Hello everybody,

    I have been working on something for most of the day, and I cannot seem to find a solution by myself. So, I thought I would give the excel forum a go and see if it is possible to do what I want in Excel.

    Here it is:

    I have some data and I want to know the moving (trailing) standard deviation. My data looks like this

    Date Value
    01-01-1999 2.014
    03-01-1999 2.122
    15-01-1999 1.980
    22-03-1999 2.005

    I now want to output the trailing 1-year standard deviation in a third column. When I try averages I can get there by using: =AVERAGEIFS(B:B;A:A;">"&A3-365;C:C;"<"&A3). With the first condition being the trailing start of period (-365 days in this case) and the second criteria being the cut off at the date of that moment.

    A similar function for STDEV does not exist. Also, similar approaches with STDEV.S(IF(.......IF(........)) do not seem to work.

    Any help is much appreciated.

    Stikker

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Moving/trailing standard deviation (multiple conditions?)

    Here's what I did, In C1 copied down

    =IFERROR(STDEV(INDEX($B$1:B1, IFERROR(MATCH(A1-365, $A$1:A1),1)):B1),"")
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    09-14-2015
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    2007
    Posts
    2

    Re: Moving/trailing standard deviation (multiple conditions?)

    Wow, that was quick. And accurate. Thanks a lot!!

    Don't understand what you did, but I checked and double checked and everything did was it was supposed to do.


    I also have a much less urgent and important question too. Say that I want to exclude std deviations from it (by returning "99" or whatever), that are based on data that does not yet cover an entire period (365 days in this case). Is there a way to do so?

    The obvious reason being, that the trailing average for 365 days, is misleading for a period that only cover the trailing two weeks or so.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Moving/trailing standard deviation (multiple conditions?)

    Sure,
    Change the formula in C1 copied down to

    =IFERROR(STDEV(INDEX($B$1:B1, MATCH(A1-365, $A$1:A1)):B1),"Incomplete")

+ 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. Moving Standard deviation
    By asavage in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-05-2008, 02:10 AM
  2. [SOLVED] how do you find the SD(standard deviation ) for the multiple reg
    By Jerry W. Lewis in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 12:05 PM
  3. how do you find the SD(standard deviation ) for the multiple reg
    By Basem Salman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  4. [SOLVED] how do you find the SD(standard deviation ) for the multiple reg
    By Jerry W. Lewis in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 AM
  5. [SOLVED] how do you find the SD(standard deviation ) for the multiple reg
    By Basem Salman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. how do you find the SD(standard deviation ) for the multiple reg
    By Basem Salman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. [SOLVED] how do you find the SD(standard deviation ) for the multiple reg
    By Basem Salman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. how do you find the SD(standard deviation ) for the multiple reg
    By Basem Salman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-07-2005, 10:05 AM

Tags for this Thread

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