+ Reply to Thread
Results 1 to 24 of 24

Charts/Graphs that change data with drop down window

  1. #1
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Charts/Graphs that change data with drop down window

    Hi,

    I can't stay away from this place... It is great hanging around genius's!

    In short...
    Is it possible to create a chart which changes it's data depending on what item is selected from a drop down list?

    In long...
    I have financial data on each day of the year and would like to be able to select a month and a day using a drop down list, which will then change the data displayed in the chart. I know I can create a sheet with 365 charts have them display on request but then I would have to create 365 charts. Is it possible to let the data change rather than the entire chart?
    Last edited by Skaapie; 12-22-2009 at 01:23 PM. Reason: Solved

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    See if these help:

    http://office.microsoft.com/en-us/ex...098011033.aspx

    http://peltiertech.com/Excel/Charts/Dynamics.html
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Hi NBVC,

    We meet again!

    I am busy looking at the links you have suggested. Thanks. Looks good so far.... will let you know.

  4. #4
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Thanks, I have looked at both the links you suggested - about five times!

    I found another Thread dealing with something similiar however I have clearly got a gap in my knowledge of excel. The links you gave deffinately gave me some more insight - but mostly made me realize how little I know.

    So now I don't know where to start...

    Any guidelines or even a order-list of what I must do would be really appreciated.

    In the attachment you will see three charts. The one I am trying to get to work is the "April Income & Expenses" chart.

    The one you see is the fruit of my learning to simply create a chart.

    What I would like it to do is, when the user selects a month using the drop down list in cell D2, the chart should display the data from that particular month.

    Where do I start? Please help.

    I have created some Named Ranges for the first two months as a test. I think I got that part right - if it helps.
    Attached Files Attached Files

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    Ok, first of all, you need to get rid of the merged columns.. merging causes so many problems... and on top of that you are mixing merged and unmerged columns...

    After you have unmerged and placed the results in consecutive columns, so that you have results in column D, then E, then F, etc.. for 30 consecutive columns,

    Then you can do the followings.

    Define some new named ranges...

    Sheet2!ChrtIncome with formula:

    =OFFSET(Sheet2!$D$51,MATCH(Sheet2!$D$2,Sheet2!$C$51:$C$2365,0)+9,0,1,30)

    Sheet2!ChrtOverheads with formula:

    =OFFSET(Sheet2!$D$51,MATCH(Sheet2!$D$2,Sheet2!$C$51:$C$2365,0)+120,0,1,30)

    Sheet2!ChrtDirectIncome with formula:

    =OFFSET(Sheet2!$D$51,MATCH(Sheet2!$D$2,Sheet2!$C$51:$C$2365,0)+188,0,1,30)

    Then change your source data values field for the chart to:

    Sheet2!ChrtIncome for Income Series

    Sheet2!ChrtOverheads for Overhead Series

    Sheet2!ChrtDirectCosts for Direct Costs Series

  6. #6
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Good day MBVC,

    Thanks for all the help! I am busy applying what you have suggested. I have a question regarding the first Range Name's formula:

    =OFFSET(Sheet2!$D$51,MATCH(Sheet2!$D$2,Sheet2!$C$51:$C$2365,0)+9,0,1,30)

    Why would you use +9 as the row number (if that is what it is)? Maybe I should ask this.. from which row did you start numbering? Is row suppose to be in line with "Receivables Variable" or "Grand Total Income"?

  7. #7
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Another Question re:

    The Range Name: Sheet2!ChrtDirectIncome

    Should it be ChrtDirectIncome or should it be ChrtDirectCosts because there is no row/column with the category Direct Income? Is this name referring to the Income or the Costs?

  8. #8
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    And finally, I think, one more question...

    In the Monthly graph, is it possible to cause the X axis to display the correct number of days (ex. 28 or 30 or 31) depending on the month selected? At the moment it only displays 30 because that is what I assigned to the axis, but I am not sure how to make it change automatically.

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    Quote Originally Posted by Skaapie View Post
    I have a question regarding the first Range Name's formula:

    =OFFSET(Sheet2!$D$51,MATCH(Sheet2!$D$2,Sheet2!$C$51:$C$2365,0)+9,0,1,30)

    Why would you use +9 as the row number (if that is what it is)? Maybe I should ask this.. from which row did you start numbering? Is row suppose to be in line with "Receivables Variable" or "Grand Total Income"?
    The formula looks for the first match to what is in D2 within range C51:C2365 and then goes down 9 rows from there to get the corresponding data you want to chart.

    Another Question re:

    The Range Name: Sheet2!ChrtDirectIncome

    Should it be ChrtDirectIncome or should it be ChrtDirectCosts because there is no row/column with the category Direct Income? Is this name referring to the Income or the Costs?
    Yes should be Sheet2!ChrtDirectICosts

    And finally, I think, one more question...

    In the Monthly graph, is it possible to cause the X axis to display the correct number of days (ex. 28 or 30 or 31) depending on the month selected? At the moment it only displays 30 because that is what I assigned to the axis, but I am not sure how to make it change automatically.
    Create another Named Range called: Sheet2!Days with formula:

    Please Login or Register  to view this content.
    and then edit the chart Series X-Values field to say: =Sheet2!Days

  10. #10
    Registered User
    Join Date
    12-22-2009
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Charts/Graphs that change data with drop down window

    you can use the concept of dynamic data base for creating a graph wherein the graph change based on the value you select from the drop down. Have attached a sample Excel file to help get the idea across.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Hi NBVC,

    You're work has been amazingly helpful and a learning experience!

    Thank you for answer all my questions. I have one more re: your last answer.

    After creating the name range, Sheet2!Days, with it's formula, you said I should, "edit the chart Series X-Values field to say: =Sheet2!Days"

    Do you mean I should change the entire formula which is already there with this or just edit wherever it says, Sheet2! to say Sheet2!Days within the existing formula?

    I did change the entire formula to =Sheet2!Days but received this error:

    "A formula in this worksheet contains one or more invalid references. Verify that your formulas contain a valid path, workbook, range name, and cell reference."

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    Try again with:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Ooops, my mistake. I must have pressed the Cancel button by accident because the Name Range & formula wasn't available when I looked for it. So I tried again and your first formula is working fine!

    I think we are done!

    MBVC, you have been an amazing help with this! When I look at the formulas you suggested I would not have worked that out - at least not before the end of next year!

    The only problem is, now everyone in the office thinks I can do the impossible! Thanks!

    You have saved me a huge amount of time! I only wish I understood those formulas more than I do. For instance...

    =OFFSET(Sheet2!$C$51,MATCH(Sheet2!$D$2,Sheet2!$C$51:$C$2365,0)-1,1,1,DAY(DATE(Sheet2!IL65494,MONTH((Sheet2!$D$2&" "&Sheet2!$D$3&", "&Sheet2!$D$1)+0)+1,0)))

    Where can I learn this stuff! Trial and error takes a looooong time!

    Anyways, thanks again for your help!


  14. #14
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    That formula probably worked, but this part: Sheet2!IL65494 should be Sheet2!$D$1

    So if you would replace the formula with the last one I gave you, it would be a better chance that it will work always...

  15. #15
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Done. Thanks for the detail.

  16. #16
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    So NBVC,

    Where would you recommend I go to learn this stuff, instead of Trial & Error and Forums? I'd like to be able to do this stuff myself.

    Anyways, thanks again for all your help. I really do appreciate it!

    Colin

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    It is really hard to point you any 1 or 2 directions for this. I, and I am sure most of us on this forum, have learned most of the stuff right here in this forum and other similar forums... you learn a lot over the years by seeing how others solve problems. There is no one book or site that can show you all the "tricks".

    Besides reviewing Excel Help for the functions to see the basics of each function.. you would have to have a sort of "sixth sense" on how to put these functions together to get to the result you want... and as my signature implies, there is not just one way to get the same result...some are more efficient, some are less efficient... some are easier to understand and some are very complex.

    Here are a couple of links to a listing of many links that this forum has compiled for people to look at and try to learn.

    I am afraid that trial and error is part of the game and is a great learning tool.

    I suggest you build yourself a library of formulas you learn.. that you can reference and adjust to your needs at different situations...

    http://www.excelforum.com/excel-gene...additions.html

    http://www.excelforum.com/excel-gene...additions.html

    Good luck and stick around.. it is amazing how much you learn by watching.

  18. #18
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Thank you,

    That does actually make me feel better. I will definitely stick around!

    I do enjoy making use of the Excel Help.

    Is there a forum where I could ask for "explanations" regarding some of the formulas you suggested? I understand parts of them but how they work together with all the formulas in formulas is a bit overwhelming. It is great to copy and paste other people's work but to understand it is another thing.

  19. #19
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    Generally, it is best to ask those questions in the thread itself (if it is your thread.. if not, start your own thread and show a link to where the formula was used).

    Most of us don't really give formal explanations unless specifically asked.. as you might understand, it does take considerable time to come up with the formula in the first place. To explain it sometimes takes even longer... and if the OP doesn't really care and just wants the formula, then it doesn't make sense to waste our time. Those who want to learn will ask for explanation as you did.

    I will try to explain in next post.

  20. #20
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    Please Login or Register  to view this content.
    This formula uses OFFSET function in order to define a range to reference..

    Syntax of OFFSET(): OFFSET(Reference,rows,columns,[height],[width])

    where Reference is the reference cell/range to offset from.
    rows is number of rows to offset from reference
    columns is number of columns to offset from reference
    height is optional is number of rows deep you want to select
    width is optional is number of columns wide you want to select.

    So we are referencing from cell D51.

    To find number of rows, I used MATCH() function, which finds the position within a range that an item is found. I am looking to match what is in D2 (the month) and find the position in range $C$51:$C$2365. Once I find it, I want to go down a further 9 rows in order to get to the row containing the data to chart.

    I am staying in column D, so I don't offset by any columns (0) and I want to only get 1 row of data worth by 30 columns wide (Note: I assume you replaced that 30 in those 3 defined ranges to DAY(DATE(Sheet2!IL65494,MONTH((Sheet2!$D$2&" "&Sheet2!$D$3&", "&Sheet2!$D$1)+0)+1,0)) to get the real widths).

    Please Login or Register  to view this content.
    This is a similar formula, but I am offsetting from C51, the number of rows is defined by matching D2 to C51:C2365 and subtracting 1. Then go down 1 row and over 1 column.. Again I want 1 row's worth of data and the width is defined by DAY(DATE(Sheet2!$D$1,MONTH((Sheet2!$D$2&" "&Sheet2!$D$3&", "&Sheet2!$D$1)+0)+1,0)) which gets the Day number using the DAY(Date) function from a date defined by DATE(Year,Month,Day) function, where year is gotten from D1, Month is gotten from creating a date by concatenating D2 with a space, then D3, then a comma, a space and D1 to form something like "April 2, 2009". The +0 converts this to a serial number Excel understands to be the equivalent of that date... then I use the MONTH() function to get the month number from that. I add 1 to go to the next month and the final 0 means day 0, which it will interpret as the day before the 1st (which is the last day of previous month).

    I hope this helps you to understand the concepts... As I said, it is sometimes harder to explain than just to come up with the formula.

    I have noticed a couple of areas in my own formulas, just by going through this explanation, that could've been improved.. but like I also said, there are many ways to skin a cat!

    Good luck.
    Last edited by NBVC; 12-22-2009 at 03:31 PM.

  21. #21
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    Thank you !

    I will be taking a look at it and will let you know how it goes. The portion I glanced at now already helps make sense of it all!

  22. #22
    Registered User
    Join Date
    10-20-2009
    Location
    BC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Charts/Graphs that change data with drop down window

    You're explanations are good!

    It takes me some time to absorb the information but it does help me understand what is "going on" within the formulas.

    I appreciate the time you took to explain that!

    I will probably refer back to it again and again.

    Blessings and Merry Christmas!

  23. #23
    Registered User
    Join Date
    06-02-2010
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Charts/Graphs that change data with drop down window

    Quote Originally Posted by sharad View Post
    you can use the concept of dynamic data base for creating a graph wherein the graph change based on the value you select from the drop down. Have attached a sample Excel file to help get the idea across.
    Have you figured out a way to do this and keep the cell formatting consistent from wherever the array data is being pulled? In my graph, for instance, some of the potential data is cost info, whereas some is a percentage. Using this setup, I can't come up with a way to have the axis labels be dynamically updated as either cost or percentage.

  24. #24
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Charts/Graphs that change data with drop down window

    Welcome to the forum,

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

    BTW.. I don't think you can update the format of the cells depending on what data you are extracting.
    Last edited by NBVC; 06-02-2010 at 02:51 PM.

+ 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