Results 1 to 8 of 8
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Chart specific values (2K3)

    I have a list of names and corresponding values and want to graph only specific name values. Using the following test data;

    Fred 10

    Dave 20

    Fred 15

    Fred 10

    Dave 10

    How can I chart just Fred's data?
    Jerry

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Chart specific values (2K3)

    By filtering the data, using AutoFilter or Advanced Filter. You need to insert field names at the top of the data table.
    See attached sample workbook.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Chart specific values (2K3)

    <img src=/S/blush.gif border=0 alt=blush width=15 height=15> Pretty obvious now you say it <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Thanks
    Jerry

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Chart specific values (2K3)

    Sorry back on this subject again. I have had a chance to look at this now and think that the autofilter may not be my preferred solution.

    Say I have the list above is there a way I can select that range and get a chart just to specific values such as Fred and if so how?
    Jerry

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Chart specific values (2K3)

    You could enter the name you want in a cell and use the Worksheet_Change event to change the source data of the chart. See attached version - enter a valid name in E1 to see the effect.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Chart specific values (2K3)

    Excellent , thank you.

    The union function has always been a mystery to me and the help files are not at all helpful. So to let me understand this I shall put in words:

    The code is looking at the value in E1 and then looping through the range and then creating an array/range(?) of values that meet the condition in E1 and then graphing it.

    Is that a fair assumption or is there a better way to explain how the union is working
    Jerry

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Chart specific values (2K3)

    A range in Excel does not need to be a rectangular block of cells. As you no doubt know, you can select discontiguous cells / areas by selecting the first one, then holding down the Ctrl key while selecting the next one etc. The resulting range is a union of contiguous areas.
    The code imitates this, except that it doesn't select cells, but builds the range as a variable. The first time the selected name is found, the variable is set to the cell containing it (analogous to selecting the cell), and for each subsequent occurrence, the variable is set to the union of the current range and the cell containing the occurrence (analogous to selecting the cell with Ctrl held down).
    Finally, the source range of the chart is set to the discontiguous range.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Chart specific values (2K3)

    Excellent, thank you, this will help me for a number of specific things for this little project i am doing <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Jerry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •