+ Reply to Thread
Results 1 to 8 of 8

Filter by multiple criteria

  1. #1
    Forum Contributor
    Join Date
    07-27-2012
    Location
    Somerset, Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    123

    Filter by multiple criteria

    See attached file.

    I’d like to add VBA to automatically filter a table (see attached example).
    I want to filter and keep everything in the table where the value in Column D equals Blue, Black, or Red.
    I also want the filter to then keep anything in Column B where the value is equal to any text string or is less than or equal to the date in cell K1.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Filter by multiple criteria

    I don't think AutoFilter can do...
    AdvancedFilter.
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Filter by multiple criteria

    Please try

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-27-2012
    Location
    Somerset, Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Filter by multiple criteria

    I tested it. Thanks, by the way. It seemed to do fine for Column D, but it didn't do the next filter on Column B

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Filter by multiple criteria

    Quote Originally Posted by scrabtree23 View Post
    I also want the filter to then keep anything in Column B where the value is equal to any text string or is less than or equal to the date in cell K1.
    Missed
    Please Login or Register  to view this content.
    Last edited by jindon; 01-07-2021 at 10:02 AM. Reason: Fixed the formula to exclude blank.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Filter by multiple criteria

    Please Login or Register  to view this content.
    Last edited by sintek; 01-07-2021 at 10:49 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Filter by multiple criteria

    @sintek
    Thanks for the CDbl tip

    I'm quite a newbie for VBA.
    Why do we convert the Date to double?

    To prevent m/d/y d/m/y conflict ?
    Last edited by Bo_Ry; 01-07-2021 at 11:03 AM.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Filter by multiple criteria

    Dates are stored as numbers...Cdbl() changes to double for filter conversion...
    Can make use of Clng() or Cdate() in some cases...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Filter with multiple criteria
    By edesroch in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-28-2020, 03:53 PM
  2. Multiple criteria filter of multiple tables with macro
    By reese_c_c in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-07-2018, 09:56 AM
  3. Replies: 0
    Last Post: 08-04-2017, 02:39 AM
  4. Filter Excel Data using vba multiple criteria multiple columns
    By pmyk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2013, 01:32 AM
  5. Need to filter multiple criteria in Label Filter
    By brassellc7994 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 04-04-2013, 12:54 PM
  6. Replies: 2
    Last Post: 06-15-2012, 05:34 PM
  7. Multiple Criteria Filter
    By gangulyatanu in forum Excel General
    Replies: 1
    Last Post: 02-07-2012, 03:18 AM

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