Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Charting / July 2004

Tip: Looking for answers? Try searching our database.

Dynamic Chart Help!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christine Wilso - 30 Jul 2004 10:18 GMT
I want to create a line chart showing monthly data from April 2001 up t
and including the current month. (ie, my data will be expanding eac
month.)

I currently receive the data in a spreadsheet and any month that ha
not yet occurred contains a zero.

I keep reading about Dynamic charts, but I have no idea what they ar
and have never 'named' a range before, so can you given me a dummie
guide to doing this please

--
Message posted from http://www.ExcelForum.com
Jon Peltier - 30 Jul 2004 12:26 GMT
Christine -

Making a dynamic chart is not too complicated, but you can't just read
about it, you have to work through a couple examples. I have a couple
examples here, and links to more examples as well:

  http://peltiertech.com/Excel/Charts/Dynamics.html

You need a few formulas to do this. If you know where your data starts,
the formulas are easier. Defining a name merely means applying a name to
a range of cells, and you can use a formula for this.

If you know the first cell with data, the formula is easier. Say the
monthly data starts in E5, and extends down column E. Press CTRL+F3 to
open the Define Names dialog (or go to Insert menu > Names > Define).
Enter a name for the first cell, MyFirst, click in the Refers To box,
then select E5 with the mouse. The Refers To box now says =Sheet1!$E$5.
Click Add, and you've created your first named range.

If you know it's column E but aren't going to know the first cell, this
formula defines MyLast as the first numeric cell in the column:

=INDEX(Sheet1!$E$1:$E$65535,MIN(IF(ISNUMBER(Sheet1!$E$1:$E$65535),ROW(Sheet1!$E$1:$E$65535),65536)),1)

It means (look up INDEX in the help files) find within the range
Sheet1!$E$1:$E$65535, the cell in the row defined by
MIN(IF(ISNUMBER(Sheet1!$E$1:$E$65535),ROW(Sheet1!$E$1:$E$65535),65536))
and in the column 1. That bit inside the min returns an array (list) of
numbers, which is equal to the row of the cell if it contains a number,
or is equal to 65536 if it doesn't contain a number. (so above the table
there can't be any numbers in column E). In the example I gave, where
the data starts in cell E5, this array is {65536, 65536, 65536, 65536,
5,6,7,8, etc}. The first four cells are non-numeric, so the first four
numbers are 65536. There are numbers in E5, E6, etc, so the row numbers
are 5,6, etc. The min of the list is 5. Index(E1:E65535,5,1) then means E5.

Now you need a formula for the last cell. Enter MyLast in the Name box,
and the refers to formula is

=INDEX(Sheet1!$E$1:$E$65535,MAX((Sheet1!$E$1:$E$65535>0)*ROW(Sheet1!$E$1:$E$65535)),1)

This finds the last cell with a positive value in column E.

Let's combine MyFirst and MyLast into a formula for the entire range of
cells they span. In the name box, enter the name MyValues, and in the
Refers To box, enter a much simpler formula:

=MyFirst:MyLast

Of course, you could combine the two previous formulas into a single
monster formula for MyValues:

=INDEX(Sheet1!$E$1:$E$65535,MIN(IF(ISNUMBER(Sheet1!$E$1:$E$65535),ROW(Sheet1!$E$1:$E$65535),65536)),1):INDEX(Sheet1!$E$1:$E$65535,MAX((Sheet1!$E$1:$E$65535>0)*ROW(Sheet1!$E$1:$E$65535)),1)

That's your defined name for the Values. To define a name for the
months, enter the name MyMonths, then enter a simple formula:

=OFFSET(MyValues,0,-1)

This means define a range the same size as MyValues, located down 0 rows
and right -1 rows (or left 1 row). I assume the months are in column D
next to the values.

Now to make the chart. Click the chart wizard button, or find Chart on
the Insert menu. In step 1, select the chart type. In step 2, click on
the series tab. In the Name box, type the name of the series (the legend
entry for the series), or click in it and select the cell with the
mouse. Clear the Y Values box, and enter =Sheet1!MyValues, referring to
the monster defined name from above. In the X Values (Category Labels)
box, enter =Sheet1!MyMonths. Continue to the end, and you will have your
first dynamic chart.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

> I want to create a line chart showing monthly data from April 2001 up to
> and including the current month. (ie, my data will be expanding each
[quoted text clipped - 9 lines]
> ---
> Message posted from http://www.ExcelForum.com/
jc - 30 Jul 2004 14:44 GMT
good question...

the way i solved this was to name a range (using the
insert --> name -->  define range dropdown menu command),
and then create a chart that points to the named range in
its data source fields.

Next I used the following macro to expand the named range:

With Range("ndx1")
       .Resize(.Rows.Count + 1, 1).Name = "ndx1"
       End With

Here my named column range is called ndx1.  Each time I
run the macro it expands the column of data by one row
down - and presto! the chart is dynamically updated.

>-----Original Message-----
>I want to create a line chart showing monthly data from April 2001 up to
>and including the current month. (ie, my data will be
expanding each
>month.)
>
>I currently receive the data in a spreadsheet and any
month that has
>not yet occurred contains a zero.
>
>I keep reading about Dynamic charts, but I have no idea
what they are
>and have never 'named' a range before, so can you given
me a dummies
>guide to doing this please!
>
>---
>Message posted from http://www.ExcelForum.com/
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.