+ Reply to Thread
Results 1 to 3 of 3

create a macro to filter categories and copy data

  1. #1
    Registered User
    Join Date
    05-25-2011
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    52

    create a macro to filter categories and copy data

    I am trying to generate a graph of many trends for an excel spreadsheet that I have. I have attached an example showing what kind of things I am working with. Basically I have a lot of data for different projects and whether or not a project ended up being a success. What I want to do is isolate different variables to see what matters. For example in the attached worksheet, if I sort for only projects from the north region I can see that only a third of the projects were successes. I would want to do that for all of the regions and copy those statistics to another sheet so I would have something that shows the success percent of each region. Now that's easy enough to do by hand on this spreadsheet, but the actual one I am working with has many more columns and many more choices in each column. So what I was trying to do was create a macro that would run through a category (let's stick with regions) and change the filter to north, copy that to sheet 2, change the region to south, copy that to sheet 2, and do that for each unique value. Then after the macro runs, I would run it for the next column to gather the statistics I want.

    That's the goal. The issue I am having is that it's very difficult to make the macro change the filter to each unique categorical value. I'm assuming I need to build an array of the unique values, then run a loop so that it will move through the values. I am not good enough with VBA to do this. If someone is capable enough to show me a code that would do what I am asking for this spreadsheet, then I would be extremely appreciative. But even just offering advice, or snippets of code, that would lead me in the right direction I would appreciate it. Thanks in advance for all of the help. Please ask questions if my request is not clear enough.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: create a macro to filter categories and copy data

    I have done something like this before. Ill try to explain it a little and see if you can modify it to what you want to search. First off this will only work if you are doing the same searches every time. I can get it to work if you want but id need more information before i came up with something. So is it the same criteria or do they change?

  3. #3
    Registered User
    Join Date
    05-25-2011
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: create a macro to filter categories and copy data

    I don't know if I understand. The categories that I will ultimately be using aren't the same as the one in this example. There are many of them. But if you could show me something that would work with this one, I would probably be able to alter it to my needs.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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