+ Reply to Thread
Results 1 to 13 of 13

Filter One Column's Values based on if Another Column has multiple values

  1. #1
    Registered User
    Join Date
    09-19-2019
    Location
    US
    MS-Off Ver
    MS Office for O365
    Posts
    6

    Filter One Column's Values based on if Another Column has multiple values

    Hi all,
    I'm pretty new to excel and need help with something (Sorry for the horrible title, didn't know how to describe what I'm looking to do).


    Essentially, given a table like this one:
    Excel_help.PNG




    I want a list of fruits that have more than one unique value under the Color column. So in this case, I would want a list of Apple and Pear to be returned/filtered (since they feature multiple Colors), and not Grape (because all of the grapes are purple).

    Would this require programming? or are there built-in functions that can help with this? Any help is greatly appreciated

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: Filter One Column's Values based on if Another Column has multiple values

    Why not add a 'helper column'. call it Multi (for multiple colors) then place a 1 if it has multi colors or a 0 if it does not. Then you can filter on A) Multi column, then B)Fruit Column to get your results

  3. #3
    Registered User
    Join Date
    09-19-2019
    Location
    US
    MS-Off Ver
    MS Office for O365
    Posts
    6

    Re: Filter One Column's Values based on if Another Column has multiple values

    thanks for the reply! that's a good idea, but there are around 200000 rows of data in my sheet so that approach isn't as feasible :/

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Filter One Column's Values based on if Another Column has multiple values

    Your horrible title is fine, as far as I'm concerned. However, it's your desired output has me wondering....


    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually).

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    09-19-2019
    Location
    US
    MS-Off Ver
    MS Office for O365
    Posts
    6

    Re: Filter One Column's Values based on if Another Column has multiple values

    Hey glenn, thanks for the help. It would be similar to the excel sheet I posted but with ~200,000 rows of data and 4300 unique 'fruits'

  6. #6
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: Filter One Column's Values based on if Another Column has multiple values

    If you filter the data with known 1 colored fruits and put a 0 in those, then you can filter on the Blank Multi colored and assume that the remainders = 1. It really can't take more than 2 minutes.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Filter One Column's Values based on if Another Column has multiple values

    Just post a sheet containeing what you expect to see and where you expect to see it... from the scenario in your picture.

  8. #8
    Registered User
    Join Date
    09-19-2019
    Location
    US
    MS-Off Ver
    MS Office for O365
    Posts
    6

    Re: Filter One Column's Values based on if Another Column has multiple values

    Ok, attached example excel file with details on what I'm looking for. Thanks so much for your help so far guys, I really appreciate it
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: Filter One Column's Values based on if Another Column has multiple values

    Again, you can filter the table for fruit to show or not to show....I did it both ways. One way as 0 OR 1, the other way by using vLookup to put the word show or hide in adjacent cell. First, I created a list of Unique values from the Fruits, then I manually put in Show or Hide in column next to the new list and used in a vLookup.
    Give this a try.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-19-2019
    Location
    US
    MS-Off Ver
    MS Office for O365
    Posts
    6

    Re: Filter One Column's Values based on if Another Column has multiple values

    Quote Originally Posted by queuesef View Post
    Again, you can filter the table for fruit to show or not to show....I did it both ways. One way as 0 OR 1, the other way by using vLookup to put the word show or hide in adjacent cell. First, I created a list of Unique values from the Fruits, then I manually put in Show or Hide in column next to the new list and used in a vLookup.
    Give this a try.
    Yes but this requires to manually enter Show/hide next to each 'fruit', which I have over 4300 of, and also would have to figure out if I want to show/hide each fruit manually (would involve going through my 200,000 rows)

  11. #11
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: Filter One Column's Values based on if Another Column has multiple values

    Take a closer look!!! There is a formula/vLookup approach. You can also write a macro, but it really isn't necessary. If you actually attempted this, you would see how fast it is. Before you complain, why not just give it a try??? You have nothing to lose. Other people take the time to build a solution - this is the LEAST you could do. THEN go ahead and criticize AFTER.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Filter One Column's Values based on if Another Column has multiple values

    This, too, requires a helper... but it's a formula, not a value.

    In D2, copied down: =SUM(INDEX(($A$2:$A$23=$A2)/COUNTIFS($A$2:$A$23,$A$2:$A$23,$C$2:$C$23,$C$2:$C$23),0))

    In F3, copied down: =IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$B$100)/(($D$2:$D$100>1)*(COUNTIF($F$2:F2,$A$2:$A$100)=0)),1)),"")

    I have no idea how it will perform with 200K rows...
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    09-19-2019
    Location
    US
    MS-Off Ver
    MS Office for O365
    Posts
    6

    Re: Filter One Column's Values based on if Another Column has multiple values

    Thanks everybody for the suggestions and help. I ended up just creating a script that iterated through the rows and counted how many different 'colors' each fruit had, and if there more than one unique value, added the fruit, # of colors as key-value pairs to a dictionary which I was then able to print to cells as a list.

+ 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. Replies: 14
    Last Post: 12-27-2018, 02:05 PM
  2. Replies: 5
    Last Post: 03-20-2014, 05:55 PM
  3. how to filter the rows based on a column which contains duplicate values...
    By Rajesh Ushakoyyala in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2013, 10:49 AM
  4. [SOLVED] Filter rows based on unique values in one column + specific value in another column
    By Dieneces in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-31-2013, 09:55 AM
  5. How to filter a column in a table based on a set of values in another column
    By redhawk87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2013, 06:24 PM
  6. [SOLVED] Counting Multiple Values in a column based on critera in seperate column
    By ERoberts in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2013, 01:08 PM
  7. filter for multiple column values
    By rgouette in forum Excel General
    Replies: 2
    Last Post: 03-10-2008, 02:08 PM

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