+ Reply to Thread
Results 1 to 9 of 9

Filter data by complex conditions.

  1. #1
    Registered User
    Join Date
    08-17-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Filter data by complex conditions.

    Hi,

    Any help on this data filtering problem I have would be much appreciated.

    In the attached spreadsheet, I have data relating to 3 individuals. Column C shows their membership of four different groups “A, B, C and D”. You will see for every group that a person belongs to, a new row entry is created.

    I want to be able to filter the data to show me only those individuals that are a member of A, B and C. I do not want the individuals name to appear in the filtered data if they are a member of D.

    So in this example, the filter would present two records to me “Tomas” and “Harris” (or their Unique Applicant ID), because they belong to A and/or B and or C BUT NOT D.

    Smith would be filtered out because although he is a member of A, B and C he is ALSO a member of D.

    You will note it is possible for an individual to be a member of a group more than once. This is fine.

    The real data sample has 11,000 entries. Help!

    Thanks,
    Terry.
    Attached Files Attached Files
    Last edited by NBVC; 08-17-2010 at 10:06 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Filter data by complex conditions.

    You can use a helper column in D..

    In D2 enter formula: =COUNTIFS(B:B,B2,C:C,"D")>0 copied down

    Then Filter for FALSE to get your results.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-17-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Filter data by complex conditions.

    Genius. Thank you NBVC.

    Is there a way to now filter down the (for example) four row entries that are displayed for Tomas to just one uniqe row entry? It doesn't matter which one of the four row entries excel displays (as I know that each row has a different group in it).

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Filter data by complex conditions.

    How did I know that was coming

    Try:

    =AND(COUNTIF($B$2:B2,B2)=1,COUNTIFS(B:B,B2,C:C,"D")=0)

    copied down and filter for TRUE this time.

  5. #5
    Registered User
    Join Date
    08-17-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Filter data by complex conditions.

    Again, Thanks!

    I'm going to push it once more and take advantage of your good nature...

    If I want to extend the exclusion to include more groups. So for example, I don't want anyone who is a member of Group C OR D, how do I add that criteria into your formula?

    If I try and add as below, I receive a too many conditions error:

    =AND(COUNTIF($B$2:B2,B2)=1,COUNTIFS(B:B,B2,C:C,"D","C")=0)

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Filter data by complex conditions.

    I think this should work:

    =AND(COUNTIF($B$2:B2,B2)=1,SUM(COUNTIFS(B:B,B2,C:C,{"C","D"}))=0)

  7. #7
    Registered User
    Join Date
    08-17-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Filter data by complex conditions.

    I think it does!

    Thanks you've been a massive help.

    Terry.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Filter data by complex conditions.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  9. #9
    Registered User
    Join Date
    08-17-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Filter data by complex conditions.

    Hi,

    Apologies. I got dragged into a meeting and didn't get chance to mark as SOLVED. Thanks for doing this for me.

    Thanks again for your help.
    Terry.

+ 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