+ Reply to Thread
Results 1 to 7 of 7

Calculate Average Number of Days based on Increase or Decrease of Price

  1. #1
    Registered User
    Join Date
    12-01-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    17

    Calculate Average Number of Days based on Increase or Decrease of Price

    Hi Friends,

    I have the below requirement. The table below has the prices of a certain item for 9 days. I have to calculate the average number of days the prices went up continuously, and the average number of days the prices went down continuously. For eg, the answer is 3 for the increase as it increased continuously for the first three days and the last three days.

    Could anyone help me with the formula required to do this task? Thanks a ton for your help.


    Day Price
    1 10
    2 20
    3 30
    4 20
    5 18
    6 16
    7 25
    8 28
    9 35

  2. #2
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: Calculate Average Number of Days based on Increase or Decrease of Price

    Assume your price is in the range(b2:b10)
    formula to count the increase =SUMPRODUCT(--(B2:B9<=B3:B10))
    in this case answer will be 5, if I am not wrong.

  3. #3
    Registered User
    Join Date
    12-01-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Calculate Average Number of Days based on Increase or Decrease of Price

    Hi Sadath31,

    Thanks for your reply. However, the result should be 3 (average number of continuous days for which the price increased). Please let me know if I have worded my question ambiguously?

  4. #4
    Forum Contributor
    Join Date
    01-24-2011
    Location
    Sheppey
    MS-Off Ver
    Excel 2010
    Posts
    239

    Re: Calculate Average Number of Days based on Increase or Decrease of Price

    Please see attached sheet for fomulas.
    But by my calculation the price only increases twice at the beginning of the week as you do not know the price before day 1.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Calculate Average Number of Days based on Increase or Decrease of Price

    Very similar solution to @BarryTSL, except you wanted the average and not the max, so another helper column was needed.

    BTW, I also agree with his comment on counting increases. Depending on your view, the first set could be 2 days of increases since the base does not really count. Alternatively, the end could be four, since 16, 25, 28, 35 all increase. You seem to change your technique on how to count the increases. I would argue the data you provided is either 2 and then 3 days (for an averages of 2.5) or 3 and then 4 days.

    I just did the increase. Decrease is similar.

    Pauley
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-01-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Calculate Average Number of Days based on Increase or Decrease of Price

    Sadath31, BarryTSL, Pauleyb,

    Thank you for your time in helping me out. Much appreciated.

    Regards, Navs.

  7. #7
    Registered User
    Join Date
    12-01-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Calculate Average Number of Days based on Increase or Decrease of Price

    You are spot on BarryTSL. I was wrong...

+ 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