+ Reply to Thread
Results 1 to 15 of 15

Calculate % change based on a chosen amount of days

  1. #1
    Registered User
    Join Date
    06-10-2013
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    57

    Calculate % change based on a chosen amount of days

    I have a string of data lets say 365 days. I want a formula that looks at last day and calculates % change based on the certain number days I choose. I want to see how a stock has changed over say last 30 days or 100 days from last settlement. How do I do this?

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,245

    Re: Calculate % change based on a chosen amount of days

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    06-10-2013
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    57

    Re: Calculate % change based on a chosen amount of days

    I attached a spreadsheet with the data.
    Attached Files Attached Files

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,911

    Re: Calculate % change based on a chosen amount of days

    =(OFFSET(B217,(G214-1)*-1,)-B217)/OFFSET(B217,(G214-1)*-1,)
    Try
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,911

    Re: Calculate % change based on a chosen amount of days

    or
    =(INDEX(B:B,ROW(B217)-G214+1)-B217)/INDEX(B:B,ROW(B217)-G214+1)

  6. #6
    Registered User
    Join Date
    06-10-2013
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    57

    Re: Calculate % change based on a chosen amount of days

    This works but I forgot to add that everyday when stock settles we add another day how can i get this formula to look at last day and then calculate 60 days from that?

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,245

    Re: Calculate % change based on a chosen amount of days

    Try this:

    =(INDIRECT("B"&MATCH(MAX(A:A),A:A,0)-G214+1)-INDIRECT("B"&MATCH(MAX(A:A),A:A,0)))/INDIRECT("B"&MATCH(MAX(A:A),A:A,0)-G214+1)

  8. #8
    Registered User
    Join Date
    06-10-2013
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    57

    Re: Calculate % change based on a chosen amount of days

    That works great but one question the data is decreasing so the percentage should be negative why is it returning a positive. Do I need to flip something in the formula?

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,245

    Re: Calculate % change based on a chosen amount of days

    It's giving the result you asked for in the attachment, which is positive.

  10. #10
    Registered User
    Join Date
    06-10-2013
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    57

    Re: Calculate % change based on a chosen amount of days

    60 days ago price was 64.07 today its 44.50 so priced decrease which should return a negative %.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,245

    Re: Calculate % change based on a chosen amount of days

    But that is not what it says in your attachment. This was the mock-up you gave us to work with:

    Excel 2016 (Windows) 32 bit
    F
    G
    214
    # Days
    60
    215
    % Change
    30.55%
    Sheet: Sheet1

    Excel 2016 (Windows) 32 bit
    G
    215
    =(B158-B217)/B158
    Sheet: Sheet1

    So please tell us what the answer for that scenario SHOULD be and why.

  12. #12
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,911

    Re: Calculate % change based on a chosen amount of days

    =(INDEX(B:B,MATCH(10^10,A:A))-INDEX(B:B,MATCH(10^10,A:A)-60+1))/INDEX(B:B,MATCH(10^10,A:A)-60+1)
    Try this

  13. #13
    Registered User
    Join Date
    06-10-2013
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    57

    Re: Calculate % change based on a chosen amount of days

    I am sorry for the confusion that scenario was a mock up and had signs backwards. i was using (original-last)/original to get my positive value but formula should have been (last-Original)/Last.

  14. #14
    Registered User
    Join Date
    06-10-2013
    Location
    houston, tx
    MS-Off Ver
    MS 365
    Posts
    57

    Re: Calculate % change based on a chosen amount of days

    Awesome that worked thank you guys.

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,245

    Re: Calculate % change based on a chosen amount of days

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Add formula to calculate amount of days
    By PKidney in forum Excel General
    Replies: 8
    Last Post: 06-26-2017, 02:14 PM
  2. [SOLVED] calculate amount of days by name
    By RachelMads02 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-05-2016, 03:02 AM
  3. [SOLVED] calculate total number of days between two days based on 365 days year
    By aparunkumar in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-14-2016, 12:51 AM
  4. [SOLVED] How to calculate debtors ageing amount in days on FIFO basis
    By King_BD in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-20-2015, 10:57 PM
  5. Calculate amount of days per year within range
    By constructionbart in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-20-2014, 05:24 AM
  6. [SOLVED] Auto fill week days based on month chosen
    By mteeters in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-14-2012, 02:45 PM
  7. How can I calculate amount of time left based on amount spent?
    By KLD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-23-2006, 11:25 AM

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