+ Reply to Thread
Results 1 to 4 of 4

Graph With a Chart

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    2

    Graph With a Chart

    Hello

    First Post. Love the forum

    I have a data validation list where the user can choose up to 10 items from a drop down. If they only want to choose 2 items, then can as well. A graph is linked to a vlookup which detects what item the user has chosen and graphs the data for the last 5 years.

    My problem is that all the 10 items show up on the graph. If someone only enters in two items, there remains 8 blank series on the legend in the graph. Is there a way to only graph the number of items that the user wants and not display all 10 items on the graph?

    So if I choose 4 items, only 4 will show up on the graph? Not the remaining 6 items that weren't selected?

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

    Re: Graph With a Chart

    Can you upload an example of how your data is laid out and operates (go Advanced>Manage Attachments)?
    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

  3. #3
    Registered User
    Join Date
    10-10-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Graph With a Chart

    Hi ChemistB. Thanks for looking into this for me. Really REALLY appreciate your expertise

    I uploaded my excel sheet to look at. I probably did not do this in the most efficient way so I will explain

    A1-A7 - that is my list for the data validation.
    D1-D7 - this is a drop down menu so someone can enter A-G in. You can have all 7 (A-G) or just 2 (A & B)
    I1-I8 (Green Chart) - This is the raw data
    I11-I18 (Pink) This is the vlookup using the raw data. Any data not entered comes in as #N/A
    I20-27 (Yellow) - This is just a prettier version of the V lookup table. I shows that if you left Item 5 blank, it will leave the data in table 5 blank.

    My Main Challenege is the graph and table showing the blank line an blank 0's across the board. I don't want those to show.

    Cheers
    Attached Files Attached Files

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

    Re: Graph With a Chart

    Okay, after a lot of deadends, I decided hiding the rows that don't have data is the easiest way to go.

    First, You don't need that second data table. I used this formula in your yellow table which can be dragged across and down

    =IF(ISNUMBER(MATCH($I21,$D$1:$D$7,0)),VLOOKUP($I21,$I$2:$M$8,COLUMN(B1),FALSE),"")

    Then it's necessary to write an event driven macro to hide rows that aren't being used.
    Copy the code here into your spreadsheet. To do that;
    1. Right click on the sheet tab and "View Code"
    2. Paste the code into the large text box that is in the window that opens up (that window is the VBA Editor)
    3. Close that window

    Please Login or Register  to view this content.
    Questions?
    Attached Files Attached Files

+ 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