+ Reply to Thread
Results 1 to 3 of 3

Performance of a stock over 20 day rolling periods

  1. #1
    Registered User
    Join Date
    05-21-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2007
    Posts
    10

    Performance of a stock over 20 day rolling periods

    I need help with financial calculations. I have 58 years (over 15000 days) of data for a stock. I would like to find a way to calculate the best and worst performance of any 20 day period (stock bought on day 1 and sold on day 20, or bought on day 2 and sold on day 21, or bought on day3 and sold on day 22, etc).

    Can anyone tell me how to do this?

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Performance of a stock over 20 day rolling periods

    HI
    if the values are in col a, Try the macro in the attached file.it lists max of successive 20 values in col B and min in col C
    ravi
    Attached Files Attached Files

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Performance of a stock over 20 day rolling periods

    Yamar, I would think if the values are in column A, then the first value in column B20 would be:

    =A20-A1

    Then you copy that down the entire dataset. You now have the differential between stock prices on the begin/end of all 20-day periods in column B.

    To get the best and worst performance:

    =MAX(B:B)
    =MIN(B:B)


    To get the ROW where those values are found:

    =MATCH(MAX(B:B),B:B,0)
    =MATCH(MIN(B:B),B:B,0)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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