+ Reply to Thread
Results 1 to 4 of 4

Cycling Formula

  1. #1
    Registered User
    Join Date
    06-02-2007
    Posts
    2

    Cycling Formula

    I have a column of Daily Simple Moving Averages and I'm trying to determine the accumulative change as long as the daily change is in the positive direction, but when the SMA changes direction and the change starts to go negative direction I need to accumulate the change in the negative direction until it changes direction again, and so on. Obviously the number of rows the SMA change remains negative or positive is unknown. And I need to be able to copy the accumulative formula down many rows. For example.

    SMA Change Accumlative
    1.0794 0.0001 0.0001
    1.0789 0.0002 0.0003
    1.0787 0.0003 0.0005
    1.0786 0.0002 0.0007
    1.0787 -0.0005 -0.0005
    1.0789 -0.0009 -0.0014
    1.0779 -0.0013 -0.0027
    1.0769 -0.0018 -0.0045
    1.0755 -0.0021 -0.0066
    1.0737 -0.0027 -0.0093
    1.0720 -0.0030 -0.0123
    1.0709 -0.0028 -0.0151
    1.0709 -0.0016 -0.0167
    1.0710 -0.0004 -0.0171
    1.0717 0.0003 0.0003
    1.0726 0.0009 0.0012
    1.0743 0.0013 0.0026
    1.0756 0.0016 0.0041
    1.0774 0.0019 0.0060
    Last edited by yinyang; 06-02-2007 at 03:23 PM. Reason: Wrong Title

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    yinyang,

    Welcome to the forum. Please read the rules below and then amend your title

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    In the example you gave, I don't see how you are getting your change figures from SMA's listed. (I'm assuming that SMA is a finacial term of art that I don't know)

    However, if your values for change are listed in column B, then put this in C2 and fill down, it will give you the desired accumulated change.

    =IF(SIGN(B2*C1)>=0,C1+B2,B2)

    Oops, forgot about 0 change, its better now
    Last edited by mikerickson; 06-02-2007 at 04:43 PM.

  4. #4
    Registered User
    Join Date
    06-02-2007
    Posts
    2

    Sma

    SMA is Simple Moving Average
    Sorry I posted the wrong data in the first column, but you got what I was asking, thanks for the answer, works great.

+ 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