+ Reply to Thread
Results 1 to 6 of 6

Update graph with new rows

  1. #1
    Registered User
    Join Date
    07-03-2017
    Location
    Sunderland, England
    MS-Off Ver
    2013
    Posts
    6

    Update graph with new rows

    Hi,
    I'm copy and pasting a table from the internet into excel. The table is live so the number of rows increases regularly. The table has 9 columns, but I'm only interested in columns C and E which give a duration and description respectively. Throughout the day there will be duplicate descriptions, but I want to have only one instance of each description with the durations summed. Then I want this to be put into a bar graph. It sounds really quite simple, but the issue I'm having is that I don't know how to keep the graph updated with each additional row that is added to the data. I've tried making the graph data range over a large number of rows but the graph will display all of them as the cells have autofilled functions in them. I have no experience with VBA but I've posted this on the VBA forum as it could be the way to go. Hope I've explained this well, and appreciate any help anyone has to offer.
    Thanks

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,689

    Re: Update graph with new rows

    Will you please attach a sample Excel workbook?

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, 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.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Update graph with new rows

    If you copy / paste your data into an Excel table and then build the chart using the table, the chart will be dynamic automatically. Excel tables know how big they are so any pivot tables, charts or formulas that reference them do not have to be changed when the amount of data in the table changes.

    So what you need to do is select all but the headers in the table and right click and select Delete -> Table rows and then paste in the new data.

    Here is some more information on tables: http://www.utteraccess.com/wiki/Tables_in_Excel.

    If you want to clear out the table using VBA, the following code will do it.
    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Registered User
    Join Date
    07-03-2017
    Location
    Sunderland, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Update graph with new rows

    Thank you for the quick responses. As requested, here is an example of what I'm trying to do, using the example of a daily schedule. Say I wanted to add to it throughout the day, but the number of rows that will be present at the end of the day is unknown. The second lot of 2 columns takes each individual event and sums the duration of all its instances. Then the third lot of 2 columns removes the blank rows between the data. So because I don't know how many rows it will have I have the formulae autofilled up to some arbitrary row, in this case row 23. The graph on the left is what I would like it to look like. But the graph on the right is what I'm getting because I want it to be prepared for the 23 rows of data if that happens to be the case on one particular day.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-03-2017
    Location
    Sunderland, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Update graph with new rows

    Thank you for the quick response. As requested, here is an example of what I'm trying to do, using the example of a daily schedule. Say I wanted to add to it throughout the day, but the number of rows that will be present at the end of the day is unknown. The second lot of 2 columns takes each individual event and sums the duration of all its instances. Then the third lot of 2 columns removes the blank rows between the data. So because I don't know how many rows it will have I have the formulae autofilled up to some arbitrary row, in this case row 23. The graph on the left is what I would like it to look like. But the graph on the right is what I'm getting because I want it to be prepared for the 23 rows of data if that happens to be the case on one particular day.
    Attached Files Attached Files

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Update graph with new rows

    Check the reference I gave you on tables.

    I copied the activities to Sheet 2 and converted them from a range to a table. Since you want a summary of this information, I used the Excel table as the data source for a pivot table (also on Sheet 2) and built the chart off of it. I decided to sort the pivot table based on duration in descending order.

    Since the pivot table is built on the excel table, when data are added or deleted from the excel table, the pivot table will readjust to the current range of the table. Unfortunately, this does not happen "automatically" - the adjustment happens automatically, but the pivot table (and chart) do not re-adjust until the pivot table is refreshed. There is a bit of VB code that can refresh the pivot table automatically whenever something changes in the excel table.
    Attached Files Attached Files

+ 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. How do I update a graph?
    By television in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-21-2015, 04:43 PM
  2. How to better update this graph each week...
    By eemiller1997 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-15-2015, 10:27 AM
  3. [SOLVED] How do I update my static line graph to allow a user to select which data to graph
    By capcon in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-31-2011, 10:22 PM
  4. Graph automatic update
    By jrortiz2 in forum Excel General
    Replies: 2
    Last Post: 03-29-2011, 09:43 AM
  5. Graph will not update
    By MoreSpeed in forum Excel General
    Replies: 3
    Last Post: 02-04-2009, 10:16 AM
  6. Pie Chart won't update like Bar Graph
    By SLOLouDog in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 11-15-2007, 02:44 AM
  7. Automatic Graph Update
    By Talbot in forum Excel General
    Replies: 2
    Last Post: 03-06-2007, 06:18 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