+ Reply to Thread
Results 1 to 8 of 8

Variable that is constantly changing

  1. #1
    Registered User
    Join Date
    10-08-2014
    Location
    london
    MS-Off Ver
    2007
    Posts
    14

    Variable that is constantly changing

    Hello, I'm not an Excel expert and unfortunately I need to go down this route as the simple route never actually existed, such is life.

    Ive been looking at numerous tutorials and everything is a blur, so I'll explain the problem briefly before I ask the question.

    I have a workbook connected to a live datafeed, I need to design a formula which can calculate a certain part of that data and return the results in the next cell along. The data is numerical and is updated every second, what I want to do is work out how much the data is increasing by every second, this will happen across multiple cells.

    I need the: total of x + 1 second, then new total of x - original total of x on a loop.

    Hows the syntax worded to assign an integer whose value is constantly changing?

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Variable that is constantly changing

    I may have read that incorrectly but cant you use the Worksheet_Calculate event to total the amounts and populate the relevant cell?

  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: Variable that is constantly changing

    What PJWhitfield is saying is you CAN use a Worksheet_Calculate() event to accomplish this. That event will trigger itself anytime the sheet calculates anything. So you could design the macro to grab the value(s) of any key cell(s) and record them in a log on another sheet for later analysis. A simplistic example:

    Please Login or Register  to view this content.
    That should get started on developing it for you workbook. This event macro will reside in the Sheet Module itself.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    10-08-2014
    Location
    london
    MS-Off Ver
    2007
    Posts
    14

    Re: Variable that is constantly changing

    Many thanks, rather than logging it into a separate spreadsheet, I was looking for cell "A" and "B" to update simultaneously, cell "A" does this automatically so I was hoping that I could simply apply a formula to cell "B" to get the results. But without learning Excel front to back I believe this is going to go way beyond my capabilities.

    Many thanks

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

    Re: Variable that is constantly changing

    If you put a formula in cell B that references cell A, it should update every time cell A does.

  6. #6
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Variable that is constantly changing

    if you're looking to see how much cell A has changed then you'll need to store the value of A before it changes and then compare.

    eg Cell A1 is updated every second and you want the amount of increase/decrease to be in Cell B1.

    Second1 A1 = 100
    Second2 A1 = 150

    to be able to calculate on A1 changing you'll need to store second1's value of A1 before A1 changes...something like this (very basic)
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-08-2014
    Location
    london
    MS-Off Ver
    2007
    Posts
    14

    Re: Variable that is constantly changing

    Many thanks PJ, your absolutely spot on, the value does need to be stored temporarily to make the calculation, the maths to get the total is beyond easy, but the coding for a newbie is tricky.

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

    Re: Variable that is constantly changing

    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] Trying to SUM a constantly changing schedule.
    By josebaptista in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-17-2013, 06:49 AM
  2. [SOLVED] Counting a variable whose value is derived from other live values constantly changing.
    By omega0010 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-24-2012, 01:14 PM
  3. Replies: 0
    Last Post: 12-11-2012, 11:10 AM
  4. Find the max value of one constantly changing cell
    By Consty1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-15-2012, 10:50 AM
  5. Web Query Help:changing constantly.
    By Rubbadub in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-25-2008, 02:48 PM

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