Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: VBA: filter with 4 condition

  1. #1
    Join Date
    13th February 2003
    Posts
    395
    Sub Macro6()

    Selection.AutoFilter Field:=13, Criteria1:="=00594", Operator:=xlOr, _
    Criteria2:="=76000"
    End Sub

    from this macro is possible to ADD another 2 criteria

    example
    00594
    76000
    99999
    88888

    tks

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    15th April 2003
    Location
    USA
    Posts
    7,302
    I don't know of a way to have more than two conditions with Autofilter. However you may want to try using the advanced filter, which can have may conditions. For example
    Range("A1:A23").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
    Range("E1:E5"), Unique:=False
    will filter the list in A1 to A23 where E1:E5 has four conditions. E1 has to have the same name as A1.

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    13th February 2003
    Posts
    395
    Originally posted by Derk
    I don't know of a way to have more than two conditions with Autofilter. However you may want to try using the advanced filter, which can have may conditions. For example
    Range("A1:A23").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
    Range("E1:E5"), Unique:=False
    will filter the list in A1 to A23 where E1:E5 has four conditions. E1 has to have the same name as A1.


    ... please a little sheet with example.
    Tks for all

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    15th April 2003
    Location
    USA
    Posts
    7,302
    See the attached for a simple example. The list is in column A and the conditions in column E

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    13th February 2003
    Posts
    395
    Originally posted by Derk
    See the attached for a simple example. The list is in column A and the conditions in column E


    Tks for all

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    13th February 2003
    Posts
    395
    Little problem (!?)

    the advanced filter start from filetr in m4 and criteria is in z4

    repair for my the macro.
    Tks, very tks.

    Excel Video Tutorials / Excel Dashboards Reports


  7. #7
    Join Date
    15th April 2003
    Location
    USA
    Posts
    7,302
    See the attached. I moved the criteria to column AA for convenience in using the current region to specify your data and to specify the criteria as rows are added or deleted. The buttons for the macro are at the top of column N.

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    13th February 2003
    Posts
    395
    Originally posted by Derk
    See the attached. I moved the criteria to column AA for convenience in using the current region to specify your data and to specify the criteria as rows are added or deleted. The buttons for the macro are at the top of column N.


    ok! Tks

    Solved?
    Time to Time

    Excel Video Tutorials / Excel Dashboards Reports


  9. #9
    Join Date
    25th January 2003
    Location
    UK
    Posts
    2,745
    Just for reference, there is a 'cheats' way that I found of using multiple criteria with AutoFilter (AF). However, it isn't very efficient as it involves repeated calls to the AF.

    If you are interested, AF on your first 2 criteria and set a range equal to the visible cells. Now repeat the process with the next set of criteria and add the visible cells to the previous range using the Union method. With Screenupdating off and relatively small amounts of data this approach is 'workable' - haven't tried it with large amounts of data!
    Cross-poster? Read this: Cross-posters
    Struggling to use tags (including Code tags)? : Forum tags

  10. #10
    Join Date
    13th February 2003
    Posts
    395
    Originally posted by Richie(UK)
    Just for reference, there is a 'cheats' way that I found of using multiple criteria with AutoFilter (AF). However, it isn't very efficient as it involves repeated calls to the AF.

    If you are interested, AF on your first 2 criteria and set a range equal to the visible cells. Now repeat the process with the next set of criteria and add the visible cells to the previous range using the Union method. With Screenupdating off and relatively small amounts of data this approach is 'workable' - haven't tried it with large amounts of data!
    a sample sheet please

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Replies: 6
    Last Post: February 23rd, 2011, 23:16
  2. Training: Reduce spam! Get your Junk E-mail Filter in top condition
    By Dave Hawley in forum Free Microsoft Excel 2007 Tutorials
    Replies: 0
    Last Post: February 21st, 2009, 23:47
  3. Filter Results Of Primary Filter Sort
    By jabuggie in forum EXCEL HELP
    Replies: 3
    Last Post: February 21st, 2008, 04:30
  4. Filter then save as filter result & date
    By spnz in forum EXCEL HELP
    Replies: 6
    Last Post: February 13th, 2006, 00:38
  5. Replies: 9
    Last Post: January 13th, 2006, 23:11

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
  •  
porno