+ Reply to Thread
Results 1 to 13 of 13

Having issues with a Macro to get Chart Data

  1. #1
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Having issues with a Macro to get Chart Data

    I was given the following code by another Forum user.

    Please Login or Register  to view this content.
    I keep getting the following error...
    "The extract range has missing or illegal field name"

    Can someone help me figure out what is wrong?

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Having issues with a Macro to get Chart Data

    Extract is a defined range name?
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Having issues with a Macro to get Chart Data

    And I have named this range and yet I still get this error. How do I resolve?

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Having issues with a Macro to get Chart Data

    Try declaring the range for Extract within the code procedure. For instance
    Please Login or Register  to view this content.
    I don't know for sure if this will solve your problem because I haven't tested it but give it a try.

  5. #5
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Having issues with a Macro to get Chart Data

    I tried using your code and put in the range information. This is what the code looks like...

    Please Login or Register  to view this content.
    And I still get that error. I have attached the workbook with the code that was given to me by the other forum user and you can look this over and help me figure out why it will not work on the real workbook. I also attached the original sample workbook I was using.

    Thanks!
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    05-07-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    354

    Re: Having issues with a Macro to get Chart Data

    is this what you rea looking for:

    Please Login or Register  to view this content.
    Regards,
    Vandan

  7. #7
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Having issues with a Macro to get Chart Data

    As you can see on from the attached workbook. I have created a pivot table from all of the repair data from multiple worksheets with in my report workbook. I am trying to create a chart that shows me just the top 3 failures and has a drop down button that I can use to select individual items and see the failures. I know I can create this using the pivot chart and slicer but I do not like the look of the slicer and would prefer to do this with a drop down button. I would also like to be able to create a macro so I can run this month after month automatically, and not spend so much time on creating it.

  8. #8
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Having issues with a Macro to get Chart Data

    It would help if I included the workbook.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    05-07-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    354

    Re: Having issues with a Macro to get Chart Data

    Hi:

    I am sure this workbook makes perfect sense to you but it is hard for me to follow.

    I will ask others to help.

  10. #10
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Having issues with a Macro to get Chart Data

    I have got it working...I am good....Thanks!

  11. #11
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Having issues with a Macro to get Chart Data

    dwhite30518,

    Attached is a modified version of your Report Charts workbook. This workbook is VBA free and uses a Data Validation list to update the chart.

    I removed the pivot tables for this particular scenario because I don't think they were working out quite the way you wanted them to. Instead, I have some index/match/countif formulas to pull the unique items list and their failure counts.

    I pulled the list of unique items from the Items List. This is performed by using this formula in the 'Summary' worksheet, cell G2 and copied down to G61:
    Please Login or Register  to view this content.
    Note: To get them to be listed alphabetically, I sorted on column A then on column B in the Summary worksheet.
    Becuase of the dynamic named ranges and that this formula is copied down to row 61, it will automatically pick up new unique entries as they are added to the Items list in sheet 'Summary', column A. (To keep the unique list in alphabetical order, you would add items to the end of the Items list, and then do a Sort, first level on Items (column A), next level on Actual Failures (column B)).


    Next I pulled the unique list of Actual Failures. This is performed by using this formula in the 'Summary' worksheet, cell H2 and copied down to H61:
    Please Login or Register  to view this content.
    Same notes apply to this as to the unique item list.


    Now that we have these unique lists, I created a named range called ItemList with this formula:
    Please Login or Register  to view this content.
    I used that as the data validation list for the 'Charts' sheet cell B2.


    Next was to get the failure counts. These are dependent on what is chosen from 'Charts' sheet cell B2. In the 'Summary' sheet cell I2 and copied down to I61 is this formula to get the counts:
    Please Login or Register  to view this content.

    Now that we have the counts, we can rank them to get the top 3 values. The rank formula is in 'Summary' sheet cell J2 and copied down to J61:
    Please Login or Register  to view this content.

    Now we have identified what the top failures are for any given item. We can extract this information to the Charts page so that we can clearly see what the top failures are. In 'Charts' sheet cell A6 and copied over and down to cell B8 is this formula:
    Please Login or Register  to view this content.

    That range is what the chart is created from. Now we can select an item from the data validation drop-down list, and the chart will automatically update to show the top 3 failures of the selected item.
    Attached Files Attached Files
    Last edited by tigeravatar; 06-05-2012 at 06:09 PM. Reason: typos
    Hope that helps,
    ~tigeravatar

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

  12. #12
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Having issues with a Macro to get Chart Data

    Quote Originally Posted by dwhite30518 View Post
    I have got it working...I am good....Thanks!
    lol, should have refreshed page before posting that monster

    Glad to hear you got it working

  13. #13
    Valued Forum Contributor
    Join Date
    05-07-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    354

    Re: Having issues with a Macro to get Chart Data

    Impressive work tigeravatar!

    New workbook is a lot easier to follow (nicely laid out) and is robust!

+ 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