+ Reply to Thread
Results 1 to 10 of 10

Plot Excel graph from a cell value which changes every minute

  1. #1
    Registered User
    Join Date
    09-04-2009
    Location
    York
    MS-Off Ver
    Excel 2003
    Posts
    10

    Plot Excel graph from a cell value which changes every minute

    Hi guys,

    I have a very basic excel sheet set up which pulls in a value from a website (Data --> From Web --> Select the table and click OK).

    The website it pulls from refreshes its data every 10 seconds. I have set the spreadsheet to refresh the cell data every minute (I think this is the minimum refresh interval you can set).

    So as it stands I have a single cell on my spreadsheet with an integer in it, which refreshes every minute (when the excel web query runs) and it populated by the latest value it pulls back.

    Is there an "easy" way to use this to plot the value of this cell over time so we can keep track of the value on a "real time" graph ?

    Any help would be much appreciated.

    Many thanks in advance

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Plot Excel graph from a cell value which changes every minute

    Hi,

    I would suggest a macro.

    For example:
    1. Setup a (hidden if you wish) worksheet, call it Sheet2
    2. Place the following code into the worksheet module for your constantly-updating worksheet (call it Sheet1, with the updating value in cell A1):
    Please Login or Register  to view this content.
    NB: To bring up the worksheet module (if you are unfamiliar with VBA), right click on the worksheet tab when in spreadsheet view, and select "View Code".
    3. Setup a named range, call it "ChartRange", and use the following formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    4. Setup your chart, and in the value range, enter the following range:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Hope this helps

  3. #3
    Registered User
    Join Date
    09-04-2009
    Location
    York
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Plot Excel graph from a cell value which changes every minute

    Quote Originally Posted by ajryan88 View Post
    Hi,

    I would suggest a macro.

    For example:
    1. Setup a (hidden if you wish) worksheet, call it Sheet2
    2. Place the following code into the worksheet module for your constantly-updating worksheet (call it Sheet1, with the updating value in cell A1):
    Please Login or Register  to view this content.
    NB: To bring up the worksheet module (if you are unfamiliar with VBA), right click on the worksheet tab when in spreadsheet view, and select "View Code".
    3. Setup a named range, call it "ChartRange", and use the following formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    4. Setup your chart, and in the value range, enter the following range:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Hope this helps

    This is excellent thankyou very much !!

    As an aside from this, I was wondering if it would be possible to amend the Sub Worksheet code in (2.) so that aswell as populating the changing value in column A, it also posts a timestamp for each entry (in Column B perhaps using the =NOW() function or similar)

    Apologies as I have practically 0 VB knowledge I know what I want to do in my head but translating it to code is my downfall haha

    So ultimately, the function would post the changing value in Column A2 for example and in B2 there would be a timestamp (using =NOW() or similar).. The sheet would refresh again after a minute and A3 would be populated with the next "changing value" figure and B3 would contain the new timestamp

    Again thanks in advance.

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Plot Excel graph from a cell value which changes every minute

    Sure no problems!

    Use this Worksheet_Calculate subroutine instead:
    Please Login or Register  to view this content.
    This will actually put your timestamp in Column A on Sheet2 so that it can be used as a timeline for your x-axis if you wish (which I supposed is why you were asking for this to occur). You will also need to change your "ChartRange" named range to incorporate this new column, so it will become
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Hope this helps

  5. #5
    Registered User
    Join Date
    09-04-2009
    Location
    York
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Plot Excel graph from a cell value which changes every minute

    That works brilliantly.

    Thanks very much, exactly what I was after. Much appreciated.

  6. #6
    Administrator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,143

    Re: Plot Excel graph from a cell value which changes every minute

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  7. #7
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Plot Excel graph from a cell value which changes every minute

    No worries

    Please don't forget to click on the * next to my post(s) just to say thanks

  8. #8
    Registered User
    Join Date
    05-18-2017
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Plot Excel graph from a cell value which changes every minute

    Quote Originally Posted by ajryan88 View Post
    Hi,

    I would suggest a macro.

    For example:
    1. Setup a (hidden if you wish) worksheet, call it Sheet2
    2. Place the following code into the worksheet module for your constantly-updating worksheet (call it Sheet1, with the updating value in cell A1):
    Please Login or Register  to view this content.
    NB: To bring up the worksheet module (if you are unfamiliar with VBA), right click on the worksheet tab when in spreadsheet view, and select "View Code".
    3. Setup a named range, call it "ChartRange", and use the following formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    4. Setup your chart, and in the value range, enter the following range:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Hope this helps
    Every time the cell updates the new value is written 86 times to sheet 2. What am I doing wrong?

  9. #9
    Registered User
    Join Date
    05-18-2017
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Plot Excel graph from a cell value which changes every minute

    Hello:

    Can you post more steps on how to run this macro? I think my main issue is in setting up the named range. I have not been able to get this to run the way it is described.

    Thank You,

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

    Re: Plot Excel graph from a cell value which changes every minute

    Mech.Eng. welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    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 some-1 helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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