+ Reply to Thread
Results 1 to 15 of 15

Dynamic Line Chart

  1. #1
    Registered User
    Join Date
    10-30-2008
    Location
    AL
    Posts
    27

    Dynamic Line Chart

    I've searched the forums and have been unable to accomplish my tasks based on what I've found.

    So I'm trying to create a dynamic line chart that updates every month. Attached is a sample workbook. In the example, I want to be able to add the month of September along with its sals and profit, and have the chart update automatically.

    I've seen some examples using the offset function, but I can't seem to get it to work.

    Thanks in advance!
    Attached Files Attached Files
    Last edited by hambone; 05-21-2010 at 11:10 AM. Reason: add file

  2. #2
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Dynamic Line Chart

    You missed the worksheet!
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  3. #3
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Dynamic Line Chart

    Click on your sales line on the graph and change the formula to :-

    =SERIES(Sheet1!$B$1,Example.xlsx!Date,Example.xlsx!Sales,1)

    same with the Profit and it should do what you want

  4. #4
    Registered User
    Join Date
    10-30-2008
    Location
    AL
    Posts
    27

    Re: Dynamic Line Chart

    Didn't seem to work. I got a "reference is not valid" message.

  5. #5
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Dynamic Line Chart

    here is the modified file
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic Line Chart

    Also, with your defined names, once you've defined "date" you can use that with OFFSET to define the others, i.e.
    Profit = OFFSET(Date,0,2)
    Much easier on the eyes and brain.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    10-30-2008
    Location
    AL
    Posts
    27

    Re: Dynamic Line Chart

    Ok guys, I must be missing something.

    I opened squiggler's file and it didn't have what I was looking for. It actually didn't have anything other than a blank graph. Obviously I must be doing something wrong.

    And ChemistB, I don't really understand your advice. Can you elaborate.

    Again, I appreciate the help

  8. #8
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Dynamic Line Chart

    Its your file with the changes, I re-downloaded it and it works fine, can any body else verify it since i am using 2010, but there shouldnt be any compatibility problems with 2007

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic Line Chart

    Robert, I downloaded your file and the data series seemed to be linked to a document on the C drive. I fixed it and attached but am getting an "illegal reference in your formula"(even though it works). Every time I tried uploading again, it became corrupted. Weird.
    Here's the log
    Please Login or Register  to view this content.
    Hambone, in answer to your question,
    If you go to "Defined Names" or "Name Manager" you can replace the two following name formulas (Note, because of problems with Squiggler's file, I substituted my own and used my formulas).
    Sales = OFFSET(Sheet1!$B$2,0,0,COUNTA(Sheet1!$B:$B)-1)
    Profit =OFFSET(Sheet1!$C$2,0,0,COUNTA(Sheet1!$A:$A)-1)

    with
    Sales = OFFSET(Date,0,1) Offsetting the date series by 1 column
    Profit = OFFSET (Date,0,2) Offsetting the date series by 2 columns.
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Dynamic Line Chart

    lol, thanks I wonder if it is Excel 2010 that is the problem?

    (BTW I am not Robert he is the person who I quoted!)

  11. #11
    Registered User
    Join Date
    10-30-2008
    Location
    AL
    Posts
    27

    Re: Dynamic Line Chart

    Thanks ChemistB. It works great. But I'm afraid I still don't understand how you did it. Can you walk me through the entire process of creating the chart. It would be much appreciated!!

    TIA!

  12. #12
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic Line Chart

    First, I defined the names. Formula Tab>Name Manager starting with Date
    =OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A$2:$A$500)) which sets the range starting at A2, offsetting 0 rows and 0 columns with a height of whatever the count is from A2 to A500. Note, you cannot skip rows or the chart won't work properly.
    Next two names use the offset again to offset the defined name Date as follows
    Sales = OFFSET(Date,0,1) Offset date by 0 rows and 1 column and similarly with Profit

    Next, right clicking on the chart and Select Data, Edit the x axis to = Sheet1!Date
    Edit Sales =Sheet1!Sales and similarly for profit.
    Note: After doing so, if you go back and look, Excel changes it to the workbook name (probably because it's a workbook defined name) like so Sales = Example!Sales.
    Then as you add more dates, the Date named range will expand which will expand Sales and Profit and these are directly linked to your chart. Hope that helped.
    Last edited by ChemistB; 05-20-2010 at 10:12 AM.

  13. #13
    Registered User
    Join Date
    10-30-2008
    Location
    AL
    Posts
    27

    Re: Dynamic Line Chart

    Thanks ChemistB. I was able to walk through your instructions perfectly. Very helpful. I hate to add an additional requirement, but suppose I wanted to graph only the last 12 months, as oppossed to simply adding on the additional month. How would I make that happen? Also, some entries will not have a total of 12 months, so I would like for this formula to be able to handle both scenarios.

    In other words, if there are 12 or more months, I would like to chart only the last 12. If there are fewer than 12 months, than I want to chart all the months.

    As always, I really appreciate the help.
    Last edited by hambone; 05-20-2010 at 01:10 PM. Reason: Clarify post

  14. #14
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic Line Chart

    You need to go back to your Defined Name "Date" Since the other two names are dependent on that one, that's the only one you need to change. This formula
    Please Login or Register  to view this content.
    will offset the rows by whatever is larger 0 or COUNTA(A2:A500)-12. It also automatically makes your range height (rows) = 12. Compare it to the original formula.
    If you don't want the height to always be 12, you could use this formula instead
    Please Login or Register  to view this content.
    Let me know if you need help working through the logic.

  15. #15
    Registered User
    Join Date
    10-30-2008
    Location
    AL
    Posts
    27

    Re: Dynamic Line Chart

    Thanks ChemistB. looks like it works great! Although I reserve the right to come back later after I've messed something up.

    Thanks again.

+ 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