Вы находитесь на странице: 1из 11

MICROSOFT

Build dynamic charts in Excel


Users will appreciate an Excel chart that updates right before their eyes.
By Susan Harkins | in Windows and Oce, May 27, 2013, 6:22 PM PST

This post was originally published in April 2012. (http://www.techrepublic.com/blog/msoce/two-


ways-to-build-dynamic-charts-in-excel/7836)

If you want to advance beyond your ordinary spreadsheet skills, creating dynamic charts is
a good place to begin that journey. The key is to dene the chart's source data as a
dynamic range. By doing so, the chart will automatically reect changes and additions to
the source data. Fortunately, the process is easy to implement in Excel 2007 and 2010 if
you're willing to use the table feature. If not, there's a more complex method. We'll explore
both.

Sign up for our Microsoft Oce newsletter!

SUBSCRIBE

The table method


First, we'll use the table feature, available in Excel 2007 and 2010-you'll be amazed at how
simple it is. The rst step is to create the table. To do so, simply select the data range and
do the following:

1. Click the Insert tab.


2. In the Tables group, click Table.
3. Excel will display the selected range, which you can change. If the table does not have
headers, be sure to uncheck the My Table Has Headers option.
4. Click OK and Excel will format the data range as a table.

Any chart you build on the table will be dynamic. To illustrate, create a quick column chart
as follows:

1. Select the table.


2. Click the Insert tab.
3. In the Charts group, choose the rst 2-D column chart in the Chart dropdown.
Now, update the chart by adding values for March and watch the chart update
automatically.

The dynamic formula method


You won't always want to turn your data range into a table. Furthermore, this feature isn't
available in pre-ribbon versions of Oce. When either is the case, there's a more complex
formula method. It relies on dynamic ranges that update automatically, similar to the way
the table does, but only with a little help from you.

Using our earlier sheet, you'll need ve dynamic ranges: one for each series and one for
the labels. Instructions for creating the dynamic range for the labels in column A follow.
Then, use these instructions to create a dynamic label for columns B through E. To create
the dynamic range for column A, do the following:
1. Click the Formulas tab.
2. Click the Dene Names option in the Dened Names group.
3. Enter a name for the dynamic range, MonthLabels.
4. Choose the current sheet. In this case, that's DynamicChart1. You can use the
worksheet, if you like. In general, it's best to limit ranges to the sheet, unless you intend
to utilize them at the workbook level.
5. Enter the following formula:
=OFFSET(DynamicChart1!$A$2,0,0,COUNTA(DynamicChart1!$A:$A))
6. Click OK.

Now, repeat the above instructions, creating a dynamic range for each series using the
following range names and formulas:

SmithSeries: =OFFSET(DynamicChart1!$B$2,0,0,COUNTA(DynamicChart1!$B:$B)-1)
JonesSeries: =OFFSET(DynamicChart1!$C$2,0,0,COUNTA(DynamicChart1!$C:$C)-1)
MichaelsSeries: =OFFSET(DynamicChart1!$D$2,0,0,COUNTA(DynamicChart1!$D:$D)-1)
HancockSeries: =OFFSET(DynamicChart1!$E$2,0,0,COUNTA(DynamicChart1!$E:$E)-1)

Notice that rst range reference starts with row 2. That's because there's a row of
headings in row 1. The second set of references refers to the entire column, enabling the
formula to accommodate all values in the column, not just a specic range. The addition of
the -1 component eliminates the heading cell from the count. The rst formula (for the
labels in column A) doesn't have this component.

It's important to remember that you must enter new data in a contiguous manner. If you
skip rows or columns, this technique won't work as expected.

You might be wondering why I added the Series label to each range name. Using the
name, alone, will confuse Excel. The series headings in row 1 are also names. Because the
chart defaults will use the label headings in each column for each series name, you can't
use those labels to name the dynamic ranges. Don't use the same labels for both your
spreadsheet headings and your dynamic range names.

Next, insert a column chart, as you did before. If you enter new data, the chart won't yet
reect it. That's because the chart, by default, references a specic data range,
DynamicChart1:A1:E3. We need to change that reference to the dynamic ranges we just
created, as follows:

1. In the chart, right-click any column.


2. From the resulting submenu, choose Select Data.
3. In the list on the left, select Smith and then click Edit. (Remember the naming conict I
mentioned? Excel uses the column heading (cell B1) to name the series.)
4. In the resulting dialog, enter a reference to Smith's dynamic range in the Series Values
control. In this case, that's =DynamicChart1!SmithSeries.
5. Click OK.

Repeat the above process to update the remaining series to reect their dynamic ranges:
DynamicChart1!JonesSeries; DynamicChart1!MichaelsSeries; and
DynamicChart1!HancockSeries.
Next, update the chart's axis labels (column A), as follows:

1. In the Select Data Source dialog, click January (in the list to the right).
2. Then, click Edit.
3. In the resulting dialog, reference the axis label's dynamic range,
DynamicChart1!MonthLabels.
4. Click OK.

You don't have to update February; Excel does that for you. Now, start entering data for
March and watch the chart automatically update! Just remember, you must enter data
contiguously; you can't skip rows or columns.

This formula method is more complex than the table method. Be careful naming the
dynamic ranges and updating the series references. It's easy to enter typos. If the chart
doesn't update, check the range references.

For a dynamic chart technique that takes a different route, read Create a dynamic Excel
chart and make your own dashboard (http://www.techrepublic.com/blog/msoce/create-a-dynamic-
excel-chart-and-make-your-own-dashboard/6282). Two example Excel worksheets demonstrating
these versions of dynamic charting are available as a free download
(http://b2b.cbsimg.net/downloads/Kaelin/DynamicChartDemo.zip).
About Susan Harkins
Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she
was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Recommended PromotedLinks byTaboola

This Strategy Game will keep you up all night!


Sparta Free Online Game

The Only 2 Sites You Need to Know About When Building a Website
Top 10 Best Website Builders

This game will keep you up all night!


Stormfall: Free Online Game

Can you use the Raspberry Pi 3 as your work PC?

Raspberry Pi 3: How much better is it than the Raspberry Pi 2?

Pi-Top review: A Raspberry Pi laptop for tinkering on the go

RelatedAds

1 MicrosoftExcel 5 TableRows

2 MicrosoftExcel2010 6 RecoverPasswords

3 DatabaseTables 7 CertificationPrograms

4 MobileSecurity 8 MalwareRemoval

WHITE PAPERS, WEBCASTS, AND DOWNLOADS

Webcasts // From IBM and CBS Interactive


Live Webcast: Managing mobile content for next-gen business collaboration
Live Webcast: Managing mobile content for next-gen business collaboration
CBS Interactive is proud to present "Managing mobile content for next-gen
business collaboration", a live, interactive webcast covering innovative use
cases for mobile productivity and solutions that deliver compelling
functionality for your entire eet of mobile devices. Join CBS Interactive
Distinguished Lecturer David Gewirtz, author of The Flexible Enterprise (the
classic book that served as a foundation for today's agile business
movement), in a lively discussion about...

SIGN UP

Webcasts // From JanRain, Inc.

Live Webcast: Customer Identity and Access Management Trends

WATCH NOW

White Papers // From APC by Schneider Electric

The Drivers and Benets of Edge Computing

DOWNLOAD NOW

Downloads // From SolarWinds

Bandwidth Analyzer Pack: Your ONE network monitoring and trac analysis tool

DOWNLOAD NOW

Downloads // From SolarWinds

Why is the App Slow? Find out with SolarWinds Server & Application Monitor

DOWNLOAD NOW

FEATURED CONTENT
Future of IT Careers
The on-demand economy
is changing work-for-hire
models around the world.

Latest ZDNet Videos


Check out the latest tech
news and insights from
our editorial team.

EDITOR'S PICKS

IBM Watson: The inside story

Rise of the million-dollar smartphone

The world's smartest cities

The undercover war on your internet secrets


RECOMMENDED SponsoredLinks

This Strategy Game will keep you up all night!


Sparta Free Online Game

The Only 2 Sites You Need to Know About When Building a Website
Top 10 Best Website Builders

byTaboola

DON'T MISS OUR LATEST UPDATES

News Update Week in Review


SUBSCRIBE SUBSCRIBE

Вам также может понравиться