+ Reply to Thread
Results 1 to 8 of 8

Compare present data with old one

  1. #1
    Registered User
    Join Date
    01-15-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Compare present data with old one

    I receive data via an API and display the most recent numeric value in a cell. This feed updates continuously.
    At every update, I would like to compare the latest value with the one received x seconds earlier - to check e.g. whether latest_value>old_value

    How can I do that?
    Thanks
    Last edited by giammy; 05-11-2020 at 05:28 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,213

    Re: Compare present data with old one

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    01-15-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Re: Compare present data with old one

    It's very simple

    There is a cell and the value of this cell say 1201.37 updates every few seconds to e.g. 1200.78. I would like to compare the more recent value with the one received say 20 seconds earlier

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    8,322

    Re: Compare present data with old one

    It's very simple
    For you perhaps...As we are not mind readers...
    There is a cell and the value of this cell say 1201.37 updates every few seconds
    This file is open continuously and the cell is ever changing???
    I would like to compare the more recent value with the one received say 20 seconds earlier
    For this to be possible, the previous value has to be stored somewhere and the difference between the two has to be stored somewhere...
    How many cells are there that need to be calculated...how often must this variance be recorded and for how long...FOREVER ???

    So you see...Not so simple...

    Back to post 2 requirement also with an explanation of how what where why

    With that been said...look at attached sample just to get an idea...Obviously will not be your setup as we have no SAMPLE FILE
    Push button to start automation...
    Attached Files Attached Files
    Last edited by sintek; 05-13-2020 at 03:09 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Registered User
    Join Date
    01-15-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Re: Compare present data with old one

    This file is open continuously for all the time I need to receive the data. The cell where the data is received is fixed.
    At regime, I may need to listen to 5 separate data streams at the same time and run the variance condition on each stream separately- so max five cells (I can scale-up the solution from one cell to five)

    The variance should be recorded only when a new value is received (I don't know a priori when a new value will be received). Only the previous values received in the last 20seconds should be stored, the rest should be deleted to free up memory as they are irrelevant to calculate the latest variance (so we should keep at least one previous value even if is older than 20sec). Only the latest variance needs to be stored, so to run the test condition on it e.g. latest_value>value_20secs_ago. This needs to be computed till the file is open.
    Yes, the above sample gives an idea as starting point.
    Thanks

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,213

    Re: Compare present data with old one

    I asked you to upload a sample WB for us to work with, but you seem reluctant to help us to help you. I really dont see what your issue is with this request, but I have a feeling that, unless you can provide a sample file, you wont be getting much more help from members here.

    Remember, you know exactly what you are working with, what your layouts are and what your expect - we, on the other hand, dont have the foggiest idea what you have.

  7. #7
    Registered User
    Join Date
    01-15-2020
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Re: Compare present data with old one

    sintek has already provided the perfect sample file: a cell spitting a new random number every few seconds
    I cannot provide a better sample WB than that. You don't have access to my API so you cannot read the numbers I receive. sintek's sample is able to replicate the right behaviour
    Thanks

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,213

    Re: Compare present data with old one

    For future reference, my comment stands - if you want our help, help us to help you by providing sample data/expectations

+ 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] Compare rows and present how equal they are in a table
    By Guran0 in forum Excel General
    Replies: 14
    Last Post: 05-11-2015, 03:04 PM
  2. [SOLVED] Compare two worksheets and present differences in a third
    By olivierpbeland in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-28-2013, 03:14 PM
  3. [SOLVED] vlookup - How to compare numbers that are present in two workbooks
    By SVTF in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-29-2013, 11:29 AM
  4. [SOLVED] Auto Hiding rows based on range/data present or not present.
    By raze in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 02-10-2013, 11:27 AM
  5. compare the data in the shapes with data present in other sheet
    By macrogeek in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-20-2011, 09:46 AM
  6. Replies: 1
    Last Post: 06-23-2011, 04:22 PM
  7. compare two worksheets and identity data that is not present in both
    By samchargers09 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-31-2010, 02:32 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