+ Reply to Thread
Results 1 to 7 of 7

autofilter macro: goto the next criteria down until certain criteria is reached

  1. #1
    Forum Contributor
    Join Date
    10-17-2008
    Location
    Vancouver
    MS-Off Ver
    2002 and XP
    Posts
    117

    autofilter macro: goto the next criteria down until certain criteria is reached

    Good Afternoon All,

    So I am trying to make an "intelligent" auto filter that with filter with increasing restriction until a certain criteria is met.

    The list runs from A5:G20. In coloumn G is the number of hours associated with each event. And in A1 I have the percentage of items showing/whole list so it I have 15 rows on the list, and I filter so that only 5 are showing, cell a1=33%

    How can I make a macro that will autofilter until the the a1=5%
    Like having filter criter = equal or greater then 1 hour,
    if a1 > 5%
    Then criteria + 1 hour
    If A1=<5%, then stop.

    basically a seed criteria of 1 hour, adding 1 hour until the value in a1 = 5%
    Last edited by rylo; 10-27-2008 at 06:46 PM. Reason: marked as solved

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    How about an example file. I think there are way too many items open for interpretation here if we try to build something to match your description.....


    rylo

  3. #3
    Forum Contributor
    Join Date
    10-17-2008
    Location
    Vancouver
    MS-Off Ver
    2002 and XP
    Posts
    117
    intelligent autofilter test.xls

    Okay, I think I attached it.

    So what I want is to have the auto filter on the hours colum criteria:
    => 1 hour, IF percentage of hours is more then 5%, then criteria is increased by 1 hour (=> 2 hours, 3 hours, 4...) untill the percentage is equal to or less than 5%

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    See how this goes.

    Please Login or Register  to view this content.
    rylo

  5. #5
    Forum Contributor
    Join Date
    10-17-2008
    Location
    Vancouver
    MS-Off Ver
    2002 and XP
    Posts
    117

    code needs some tweaking

    seems to work well except for the stop process.

    It filtered to the highest result, even if the 5% could be acheived earlier.

    I've expanded the name list so that issue is a little more clear.
    Attached Files Attached Files
    Last edited by kuraitori; 10-24-2008 at 04:55 PM.

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Change the last bit to be

    Please Login or Register  to view this content.
    rylo

  7. #7
    Forum Contributor
    Join Date
    10-17-2008
    Location
    Vancouver
    MS-Off Ver
    2002 and XP
    Posts
    117

    back in business and aint it grand

    thank you. That last alteration really did the trick. Thank you

    Now how do I mark this thread solved?

+ 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