+ Reply to Thread
Results 1 to 16 of 16

Real-Time Chart (a moving window of time)

  1. #1
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Real-Time Chart (a moving window of time)

    Hello World!

    To state my problem simply:

    In Excel 2013, I have a line graph which charts real-time data (incoming from industrial humidity/temperature/dew point transmitters). It expands to accommodate incoming data from the receiver, but I want to be able to have the first entry displayed on the graph to be variable, essentially dragging along as new data is added. Thus, a constant window of, let's say, 50 data points which will include the most recent data point and the 49 previous ones ALWAYS - a real-time moving window.

    I've tried using the COUNTA function for the initial row-value of the x-axis on the graph which basically counted all rows in column A (my date-time X-axis which I want to "drag along") and then subtracted 50 from it. However, I get an error no matter what...

    Example1: =Sheet1!$A$COUNTA(Sheet1!$A:$A)-50, $A$100
    Example2: =Sheet1!$A$(COUNTA(Sheet1!$A:$A)-50), $A$100

    My hope was that the newest data would be displayed via $A$100 (and all data between newest and initial, obviously)
    and my initial point would, in this case, be row 50. Then, when the next row of data comes in my newest data point would be row 101 and my initial point would be 51,
    keeping a 50 point interval in view on the graph at all times.

    This, however, has resulted in failure and disappointment...

    Any ideas??

    Thank you for your time!
    Last edited by MCS89; 04-04-2018 at 09:23 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Real-Time Chart (a moving window of time)

    You will need to INDIRECT to be able to do what you are trying.

    I've always liked Stephen Bullen's FunCht7.zip, which allows you to zoom and scroll through a large data set - you can download it from here:

    http://www.oaltd.co.uk/Excel/Default.htm

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Thank you, Pete! I'll check that out!

  4. #4
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Using this for my x-axis: =Sheet1!INDIRECT($W$14):$A$692
    Cell W14 has this value and formula: [value=$A$639] ="$A$"&COUNTA(Sheet1!$A:$A)-52

    However, the formula for my x-axis is giving me an error... Any idea why?

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Real-Time Chart (a moving window of time)

    Try it like this:

    =INDIRECT("'Sheet1'!A" & COUNTA(Sheet1!$A:$A)-52 &":A" & COUNTA(Sheet1!$A:$A))

    if you only want to see the last 52 items.

    Hope this helps

    Pete

  6. #6
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Unfortunately, it says "The formula is invalid."
    It seems to do that anytime I don't have "Sheet1!" (without quotes) directly after the = sign.\

    Edit: I added "Sheet1!" (without quotes) after the equal sign, but got the same error message I was before...
    Last edited by MCS89; 04-04-2018 at 12:36 PM.

  7. #7
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Well, I just did a correct INDIRECT, meaning I put W14 in Cell V14 and then used ...INDIRECT($V$14)..., but still nothing.

    I must have tried 15 different ways, now... This thing is kickin' my a**...

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,534

    Re: Real-Time Chart (a moving window of time)

    Hello MCS89 and Welcome to Excel Forum.
    Perhaps this will help.
    Column A is a mock up of humidity readings.
    Cell B1 displays the first row of the most recent 50 rows of data using: =LOOKUP(2,1/(A2:A1000),ROW(2:1000))-49
    B2:B110 identify the most recent 50 humidity readings using: =IF(AND(ROW()>=B$1,A3<>""),ROW()-B$1+1,"")
    C2:C51 display the most recent 50 humidity readings using: =INDEX(A$2:A$110,MATCH(ROW(1:1),B$2:B$110,0))
    The graph (scatter plot) takes the values from column C. The x axis values are manually set from 1 to 50.
    Test by adding a value into cell A102 and/or deleting the value in cell A101
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  9. #9
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Wow, this was SO CLOSE to working for me. Thank you for the reply!!! The chart did like it was supposed to do; however, starting with row 50 of the moving window, the value is replaced with NOTHING... No idea why. So, after my first new reading, I still have rows 1-49. After the second new reading, I only have 1-48 (still in their correct places, but with a blank space where the 50 and 49 values should be...and so on with each new reading... This affects my four chart series values (y1-4) that are dependent on the 1-50 values.

    Your B1 is my U1. =LOOKUP(2,1/(A5:A100000),ROW(5:100000))-49
    Your B2:B110 is my V5:V100000. =IF(AND(ROW()>=U$1,A1323<>""),ROW()-U$1+1,"")

    Your C2:C51 is my:

    W106:W155 (x-axis) =INDEX(A$5:A$100000,MATCH(ROW(1:1),V$5:V$100000,0))
    X106:X155 (y1) =INDEX(F$5:F$100000,MATCH(ROW(1:1),V$5:V$100000,0))
    Y106:Y155 (y2) =INDEX(J$5:J$100000,MATCH(ROW(1:1),V$5:V$100000,0))
    Z106:Z155 (y3) =INDEX(N$5:N$100000,MATCH(ROW(1:1),V$5:V$100000,0))
    AA106:AA155 (y4) =INDEX(R$5:R$100000,MATCH(ROW(1:1),V$5:V$100000,0))

    Any idea why this would happen? It doesn't happen with yours

    I am using a dynamic x-axis as described (above). That's the only real difference I can see between your worksheet and my ever so slight modification of it.

    04/02/18 12:31:43 <-- That's what the values are like in my A column, my x-axis. They're in the Text format.

    Thanks, again, for your time!

    Edit: Could it be a time issue? I'm having to use a 32-bit laptop, so it's slow from the get-go... maybe the U1 value isn't updating fast enough for each new entry or something??? I have no idea. *cries*

    Edit2: Well, I thought I had it figured out ... I thought MAYBE it's the way the incoming data system is set up causing the row to go blank. It seems like the final row (newest, incoming row) puts data where it goes and clears ALL columns on the row to the right of the last reading. To get around this, I moved the 1-50 (IF statement functions) to a 2nd sheet in the correct row and linked it appropriately -- Sheet1! where needed. The 1-50 values showed up correctly, but it has the exact same problem as when it's on the first sheet...
    Last edited by MCS89; 04-09-2018 at 10:58 AM.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,534

    Re: Real-Time Chart (a moving window of time)

    I doubt that it is a time issue. Check the bottom left corner of the spreadsheet and make sure that the word Calculate isn't displayed. If so select the word Calculate, or press the F9 key. Then go to the File tab > Options > Formulas and select Automatic under Calculation options.
    Here is my interpretation of a sample of your file to show that what you are doing should be possible. To really help we would probably need to see a sample of your workbook.
    To upload a sample workbook click on the GO ADVANCED button below the Quick Reply window and then scroll down to Manage Attachments to open the upload window. Make sure there is just enough data to demonstrate your need. Remember to desensitize the data, if necessary.
    Let us know if you have any questions.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Okay... Even when I manually add a new entry (say, copy and paste a previous time or just type some value) into the A column it clears the 50. The next time I add a value, the 49 also disappears and so on. It can't just be the incoming data system. It DOES clear ALL columns on the row of the incoming data to the right of the last entry on the row when the data is automatically incoming. However, when I manually add a new entry into the A column it only clears the 50, then 49, then 48 values, but does NOT affect columns to the right like with automatic incoming data (while logging data.) NO idea why that is.

    I've attached a version which ONLY has the U1 cell input (lookup function) and the 1-50 values (If statements) on the last 50 readings. I removed my charts and other stuff to make the attachment adhere to the size limit.

    Thanks, again, for all your help!

    Add a value to the A column and then be sure to have some padding on your keyboard for when your head hits it. XD


    Edit: I was able to make it work with manual input by dragging the formula down a few rows. Sadly, this doesn't work for automatic input. I tried moving the column of 1-50 values WAYYY over to the right in hopes the "wipe" has a horizontal limit. It does not... Today is the last day I have to work on this. Tomorrow, I gotta bring whatever I have to the client. May God have mercy on my soul.
    Attached Files Attached Files
    Last edited by MCS89; 04-09-2018 at 02:18 PM.

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,534

    Re: Real-Time Chart (a moving window of time)

    In the last installment the issue with column V is that the formula is only copied down as far as row 1357. Paste the following in V5 and copy down to V2806:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I tested by both copying and typing date/time into A1358 and both worked.
    Let us know if you have any questions.

  13. #13
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Yeah, that works for manual input, as I stated in the edit I made on my last post. However, column V (on the incoming row) gets wiped whenever the new data comes in automatically (using the "Start Logging" button). I've got no idea what to do about it. It'd be fine if only the last 49 values were able to be captured, leaving the most recent reading off, but then how do we make the 1-49 values go down (while considering that the newest row will always get wiped)? It shouldn't matter if the newest row gets wiped if we're not trying to push the 50 value into the newest row (in column V), but that's the trick to making the 1-50 column go down with the table, isn't it? Having the formula get copied down a row upon expansion (when on the LAST row)... Crap. I don't know, guys. Maybe it can't be done with this stupid iLog excel worksheet.

    I checked the code via the Developer's tab but couldn't find anything related to wiping ALL columns on the incoming row. Especially not spanning MULTIPLE SHEETS. Makes NO sense.

    HOLY SHITAKE! Copying that into the whole column on the 2nd sheet actually works! It didn't earlier because I was counting on it getting pulled down like on Sheet1. Formatting the whole column over there did the trick. Now, to link my data to that instead while still grabbing the correct values... I'm off to try! Thank you!!!

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,534

    Re: Real-Time Chart (a moving window of time)

    Just an example, based on the Book1(MCS89) file, of how you might set things up if you wanted to leave the chart on sheet1.
    Let us know if you have any questions.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    04-04-2018
    Location
    Carson, USA
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Real-Time Chart (a moving window of time)

    Thank you guys, SO MUCH! The client was well satisfied. He said, "Wow! You're the MAN if you did that in Excel!" I told him I did but not without the help of excelforum.com.

    For anyone else having a similar issue, the solution that worked for me (albeit my case is a special one considering the use of iLog) is as follows:

    - I moved the static table which fills with the last 50 values to Sheet2.
    -- =INDEX(Sheet1!A$5:A$999999,MATCH(ROW(1:1),Sheet2!L$5:L$999999,0))

    - I copied the IF Statement formulas into a column on the second sheet ranging from 5 to 999,999, meaning the chart can have 999,995 entries. At a rate of two readings per minute, that's 347.22 days worth of logging and real-time charting (for display on the work floor.)
    -- =IF(AND(ROW()>=Sheet1!U$1,Sheet1!A5<>""),ROW()-Sheet1!U$1+1,"")


    Thanks, again, Jete and Pete! YOU are THE MEN!

  16. #16
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,534

    Re: Real-Time Chart (a moving window of time)

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools drop down in the ribbon above your first post. I hope that you have a blessed day.

+ 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. Real Time, Hourly Gantt Chart?
    By Catering in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-25-2015, 03:02 PM
  2. How to make a real time active line chart
    By semajjames in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-03-2015, 12:22 PM
  3. [SOLVED] IF function: Early/On Time/Late Time vs. set window of time
    By hclark579 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2014, 05:37 PM
  4. chart that changes in real time
    By Elainefish in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 06-19-2013, 09:39 AM
  5. Real Time Line Chart revisited.
    By GuluGuluu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2012, 09:32 AM
  6. Formula for Calculating Paid Time Off for fiscal anniversary date real time
    By 168rockwood in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-07-2012, 04:15 PM
  7. Replies: 4
    Last Post: 01-11-2012, 07:59 PM

Tags for this Thread

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