+ Reply to Thread
Results 1 to 5 of 5

Filtering multiple Columns

Hybrid View

  1. #1
    Registered User
    Join Date
    06-01-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Filtering multiple Columns

    I have Names in Column-A and Dates in Column-B. (Sorted in Ascending Order by Column-B and then by Column-A)
    I am running ADVANCE filtering for unique rows in Column-A and then running a AUTO-FILTER (CUSTOM) on Column-B to select rows with dates within a range.
    However, the CUSTOM filter seems to be filtering from *all* rows rather than just from the ones resulting from the earlier filter on Column-A.

    Is this expected? If not, what am I doing wrong? If yes, then how do I accomplish what I need?

    Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: Filtering multiple Columns

    Here's a simple way to accomplish it using autofilter on 2 helper cols
    With your data as posted running in A2:B2 down (Names, Dates)
    Insert 2 new cols A & B
    Put in B2: =IF(C2="","",IF(COUNTIF(C$2:C2,C2)>1,"","x"))
    Copy down all the way to flag all unique names
    Then place in A2: =IF(AND(B2="x",D2>=--"15Sep2012",D2<=--"29Sep2012"),"x","")
    Copy down to flag it only for the unique names (the condition: B2="x" ensures this)
    and where the dates fall within the range specified
    Then just autofilter on col A, choose: x
    -------
    Success? Celebrate it, click the little star at the bottom left of my responses

  3. #3
    Registered User
    Join Date
    06-01-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Filtering multiple Columns

    Thanks, Max. This produces the desired results. However, I will like to set up a Macro to do this. I can RECORD a Macro while doing it manually; unfortunately, the problem is that in real life the NAME/DATE data is not always in Col-A and B . . . . HOWEVER, all Columns do have titles in Row-1 and that is what I have to use to identify the Date/Name columns. Also, the date range for comparison is to be obtained from the end user via a prompt! (and, of course, this date supplied by the end-user will need to pass some minimal sanity check).

    Thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: Filtering multiple Columns

    Would suggest that you put in a new post in programming forum for help from vba savvy responders to generalize your recorded macro going by your additional specs/identifiers. OFFSET using MATCH for the col param could be used for flexibility to grab the correct cols for Date/Name (via fixed col header text descripts for example), albeit this would make the expression much longer. As for the start/enddates specs by user, believe there's a variety of vba ways to achieve this in your ultimate solution. Probably its too much to ask/expect answers in a single posting, hence you should break it up and put it all in as several different posts in programming forum

  5. #5
    Registered User
    Join Date
    06-01-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Filtering multiple Columns

    Thanks very much for the suggestion. I will definitely follow it.

    Best Regards

+ 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