+ Reply to Thread
Results 1 to 13 of 13

Automatic Calculation

  1. #1
    Registered User
    Join Date
    05-04-2018
    Location
    Hamburg, Germany
    MS-Off Ver
    Microsoft 365
    Posts
    27

    Automatic Calculation

    Hi,
    I have a question concerning the calculation of a simple percent change between two values. That is of course not a real problem.
    But what is for me is a problem is that the time period for calculating the percent change between two values is changing.
    In the example below I have calculated a 10 day percent change between two values; e.g. I have manually calculated the percent change between value 1,456.38 in row 36 and value 1,448.31 in row 27.
    What I want is changing the value in cell C1 and then the percent change between two values is calculated automatically according to the value in cell C1.
    In my example the value 10 is entered in cell C1 so I calculate the percent change between the current value and the value 10 days ago.
    If I now enter the value 14 in cell C1 the percent change between the current value and the value 14 days ago should be calculated automatically. How can this be done?

    Sapmle Calulation.png

    A B C
    1 1,418.30 10
    2 1,416.60
    3 1,418.34
    4 1,409.71
    5 1,412.84
    6 1,412.11
    7 1,414.85
    8 1,423.82
    9 1,430.73
    10 1,431.90 0.96
    11 1,430.62 0.99
    12 1,426.37 0.57
    13 1,430.50 1.47
    14 1,422.95 0.72
    15 1,427.99 1.12
    16 1,440.13 1.79
    17 1,423.90 0.01
    18 1,422.18 -0.60
    19 1,420.62 -0.79
    20 1,428.82 -0.13
    21 1,438.24 0.83
    22 1,445.94 1.08
    23 1,448.39 1.79
    24 1,446.99 1.33
    25 1,448.00 0.55
    26 1,450.02 1.83
    27 1,448.31 1.84
    28 1,438.06 1.23
    29 1,433.37 0.32
    30 1,444.26 0.42
    31 1,455.30 0.65
    32 1,456.81 0.58
    33 1,455.54 0.59
    34 1,459.68 0.81
    35 1,457.63 0.52
    36 1,456.38 0.56 =+((100*A36)/A27)-100


    Thanks a lot for your efforts.
    Thomas

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Automatic Calculation

    Thomas,

    You have a few options here, one would be:

    B1: =IF(ROWS(A$1:A1)<=$C$1;"";100*($A1/INDEX($A:$A;ROW(A1)-$C$1)-1))
    copied down

    You could also use OFFSET which would be simpler (syntax) but Volatile.

  3. #3
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: Automatic Calculation

    Can you share sample file.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  4. #4
    Registered User
    Join Date
    05-04-2018
    Location
    Hamburg, Germany
    MS-Off Ver
    Microsoft 365
    Posts
    27

    Re: Automatic Calculation

    Hi XLent,

    first of all, many thanks for your help.
    Unfortunately I have to reply that I get an error message when I enter your formula in cell B1.
    =IF(ROWS(A$1:A1)<=$C$1;"";100*($A1/INDEX($A:$A;ROW(A1)-$C$1)-1))

    The error message is:
    "There is problem wit this formula.
    Not trying to type this formula? ....

    In the formula the part $C$1 is highlighted.
    =IF(ROWS(A$1:A1)<=$C$1;"";100*($A1/INDEX($A:$A;ROW(A1)-$C$1)-1))

    Thanks again,
    Thomas

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,991

    Re: Automatic Calculation

    Attach the workbook.

    Unfortunately the attachment icon doesn't work at the moment (it hasn't worked for years, and despite our repeatedly asking the technical team who own the forum to fix it, they can't be bothered to do so), 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.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    05-04-2018
    Location
    Hamburg, Germany
    MS-Off Ver
    Microsoft 365
    Posts
    27

    Re: Automatic Calculation

    Hi avk,

    see comment from AliGW.

    Thanks

  7. #7
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Automatic Calculation

    Quote Originally Posted by francis-bacon View Post
    Hi XLent,

    first of all, many thanks for your help.
    Unfortunately I have to reply that I get an error message when I enter your formula in cell B1.
    I had assumed given your locale you would be using the ; delimiter but, perhaps, you're using , in which case:

    B1: =IF(ROWS(A$1:A1)<=$C$1,"",100*($A1/INDEX($A:$A,ROW(A1)-$C$1)-1))
    copied down

    edit:

    in reference to attachments -- you can add an Attachment but follow the directions at the end of AliGW's prior post - i.e. Go Advanced when replying and use Manage Attachments link (as opposed to the icon).

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,991

    Re: Automatic Calculation

    Hi avk,

    see comment from AliGW.

    Thanks
    No, that was meant for you. YOU need to provide the workbook - it's your problem.

    EDIT: to clarify, by "your problem" I mean it is your query, so it's your responsibility to provide the workbook.
    Last edited by AliGW; 08-10-2019 at 03:41 AM. Reason: Clarification for the benefit of the member who reported my post.

  9. #9
    Registered User
    Join Date
    05-04-2018
    Location
    Hamburg, Germany
    MS-Off Ver
    Microsoft 365
    Posts
    27

    Re: Automatic Calculation

    Hi XLent,

    again many thanks for your help.

    This time the formula works fine.

    Although I live in Germany I use the American English version of Windows 10 with the English settings for date, time, and number settings.

    I will attach the Excel file. I thought it is not possible to attach a file but only the icon that does not work.
    Attached Files Attached Files

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

    Re: Automatic Calculation

    Works fine here in your workbook (see column D):

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    F
    1
    **1,418.30
    **
    10
    =IF(ROWS(A$1:A1)<=$C$1,"",100*($A1/INDEX($A:$A,ROW(A1)-$C$1)-1))
    2
    **1,416.60
    **
    3
    **1,418.34
    **
    4
    **1,409.71
    **
    5
    **1,412.84
    **
    6
    **1,412.11
    **
    7
    **1,414.85
    **
    8
    **1,423.82
    **
    9
    **1,430.73
    **
    10
    **1,431.90
    **
    11
    **1,430.62
    **0.87
    0.87
    12
    **1,426.37
    **0.69
    0.69
    13
    **1,430.50
    **0.86
    0.86
    14
    **1,422.95
    **0.94
    0.94
    15
    **1,427.99
    **1.07
    1.07
    16
    **1,440.13
    **1.98
    1.98
    17
    **1,423.90
    **0.64
    0.64
    18
    **1,422.18
    **-0.12
    -0.12
    19
    **1,420.62
    **-0.71
    -0.71
    20
    **1,428.82
    **-0.22
    -0.22
    21
    **1,438.24
    **0.53
    0.53
    22
    **1,445.94
    **1.37
    1.37
    23
    **1,448.39
    **1.25
    1.25
    Sheet: Sheet1

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

    Re: Automatic Calculation

    I see you've marked this as solved. What was the issue in the end?

  12. #12
    Registered User
    Join Date
    05-04-2018
    Location
    Hamburg, Germany
    MS-Off Ver
    Microsoft 365
    Posts
    27

    Re: Automatic Calculation

    Hi AliGW,

    the formula is working fine, so there in no more any issue. I have therefore marked the topic as solved. Isn't that the right procedure?

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,991

    Re: Automatic Calculation

    Yes, but it's courteous to those who have helped you to sign the thread off here and say how it was resolved - this is also useful for anyone viewing the thread later.

+ 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] VBA to open a workbook with manual calculation and close with automatic calculation
    By thedunna in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-04-2019, 12:28 PM
  2. Automatic Calculation- Active Worksheet Only
    By The Skipper in forum Excel General
    Replies: 1
    Last Post: 01-03-2013, 12:30 PM
  3. [SOLVED] Automatic calculation?
    By disc1 in forum Excel General
    Replies: 3
    Last Post: 09-10-2012, 09:29 PM
  4. Automatic Calculation
    By Wabito Express in forum Excel General
    Replies: 2
    Last Post: 05-15-2012, 10:37 PM
  5. Automatic calculation
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2009, 02:18 PM
  6. Automatic Calculation
    By peacelittleone in forum Excel General
    Replies: 4
    Last Post: 03-15-2006, 02:58 PM
  7. Automatic calculation
    By krabople in forum Excel General
    Replies: 2
    Last Post: 03-03-2006, 06:03 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