Automatically Updating Charts for Additional Data in Excel
Excel shines at turning your data into charts—graphical representations of your data. You can easily create a chart based on a range of data in a . Normally, if you add additional data to your range, you will need to once again create the chart or at best change the range of cells on which the chart is based.
If you get tired of modifying charts to refer to new data ranges, there are a couple of shortcuts you can try out. The first shortcut works fine if you simply need to "fine tune" the range used in a chart. (This approach only works if the chart is on object on the same worksheet that contains the data on which the chart is based.) Follow these steps:
- Enter any new data to the table on which the chart is based.
- Select all the cells that you just entered.
- Click anywhere on the selection border around the cells. (Don't click on the fill handle.)
- Drag the selection toward the chart and drop it on the chart.
That's it—Excel incorporates the new data right into the existing chart, slick as a whistle.
Another approach is to add new data to the range not at the end, but somewhere within the range. For instance, you may have some data that represents a time period, such as 11/1 through 11/13, and you create a chart based on those dates. If you add new data to the end of the range (after 11/13), then Excel doesn't know you want those items added to the chart.
Instead, insert some blank rows somewhere within the data range; it doesn't matter where, as long as the record for 11/13 is below the added rows. You can then add the new data in the new rows, and the chart is automatically updated to include the data.
One drawback to this approach, of course, is that the inserted data will be out of order when compared to the overall structure of the data table. It is interesting to note that for some types of data—such as those based on dates—Excel will automatically sort the data by date as it presents it in the chart, but not in the data table itself. You can always use Excel's sort feature to reorder the data in the table, all without affecting what is presented in the chart.
Still another approach is to create a "dynamic range." This approach works well if the data range you are charting is the only data on the worksheet. Follow these steps:
- Create your data table as you normally would. (To keep things simple, we'll assume that you are creating a two-column data table, in columns A and B, that you then want to chart.)
- Create your chart, as desired.
- With the worksheet visible, display either the Define Name or New Name dialog box (Click here to see a related figure.) depending on your version of Excel. In Excel 2007 display the Formulas tab of the ribbon and, in the Defined Names group, click Define Name. In older versions of Excel click on Insert | Name | Define.
- In the Names in Workbook or Name field (depending on your version of Excel) enter a name that will refer to the data in column A.
- In the Refers To field, enter the following formula. You should change the sheet name and beginning cell (in this case $A$2), as necessary. If you change the beginning cell, you should also change the final part of the formula (-1) to be one less than the row number of the beginning cell. Thus, if you change the beginning cell to $A$5, you should change the final part of the formula to -4.
- Click OK (Excel 2007) or Add (older versions). Excel creates the name and associates it with the formula you entered. In versions of Excel prior to Excel 2007 the Define Name dialog box should still be visible, with the newly defined name listed.
- If you are 2007, again display the New Name dialog box by displaying the Formulas tab of the ribbon and clicking Define Name.
- In the Names in Workbook or Name field (depending on your version of Excel) enter a name that will refer to the data in column B.
- In the Refers To field, enter the following formula. (You should make the same type of changes to the sheet name, beginning cell, and final part of the formula as described in step 5.)
- Click OK (Excel 2007) or Add (older versions). Excel creates the name.
- If you are using a version of Excel prior to Excel 2007, click OK to close the Define Name dialog box.
- Display the chart and select the data series. (There should only be one data series, since this is a simple two-column data table.) The formula bar will display a formula similar to the following:
- Replace the ranges in the formula with the names you defined earlier in these steps. Assuming you defined the names Dates and Readings in steps 6 and 9, the formula should look like this:
Now the chart will update automatically regardless of where you add information in your data table. This works because the names you defined in steps 6 and 10 refer to a formula that calculates the extent of data in columns A and B of your worksheet.
There are many other ways that you can create dynamic ranges, depending on the characteristics of the data you are using. For additional information, see these Web resources:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2933) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007