+ Reply to Thread
Results 1 to 9 of 9

Multiple Column filter

Hybrid View

  1. #1
    Registered User
    Join Date
    06-30-2016
    Location
    Denver, CO
    MS-Off Ver
    excel 2013
    Posts
    3

    Multiple Column filter

    I am trying to create a macro that looks at two different columns and hides all the other data if these two match.
    For example:
    Say is Column A we have fruit:
    Strawberries
    Bananas
    Watermellon
    Strawberries

    Say in Column B we have the amount of each fruit:
    15
    12
    4
    6
    I want to filter through column A and look for strawberries but ONLY display strawberries when there are 15 of them (rather just both 15 and 6). So I need to check column B for the value as well. and then hide everything else.
    I am completely stuck so any sample code would be incredibly helpful!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Multiple Column filter

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Multiple Column filter

    Moderation request removed.
    Last edited by jason.b75; 07-01-2016 at 02:59 PM.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,760

    Re: Multiple Column filter

    Something like this could perhaps be of help? I assume row 1 i.e. cell A1 and B1 are headings, this will make result more readable.

    Option Explicit
    
    Sub FiltValu()
    
    With Range("A1").CurrentRegion
        .AutoFilter Field:=1, Criteria1:="Strawberries"
        .AutoFilter Field:=2, Criteria1:="15"
    End With
    
    End Sub
    Alf

  5. #5
    Registered User
    Join Date
    06-30-2016
    Location
    Denver, CO
    MS-Off Ver
    excel 2013
    Posts
    3

    Re: Multiple Column filter

    Here is the example if the of statement I am trying to use (or at least the logic)

    IF(((I3= "Strawberries") AND( (J3=2)) OR( ((I3="Bananas") AND( (J3=8)) OR((I3="Kiwis") AND( (J3=32)) OR((I3="Blueberries") AND(J3=31)) OR((I3="Oranges") AND( (J3=4) OR((I3="Watermellon") AND( (J3=13))); "True";"False")

    So if those two categories match up it would display True or False in Column K.
    Eventually I do just want to hide all other data in columns I and J and just display the ones that meet these criteria.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Multiple Column filter

    Moderation request removed.
    Last edited by jason.b75; 07-01-2016 at 02:59 PM.

  7. #7
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,760

    Re: Multiple Column filter

    Hi jason

    FDibbins closed this thread

    http://www.excelforum.com/excel-prog...mn-filter.html

    but the one I'm posting in is open for forum members so perhaps you should modify your comments a bit in post #6

    Alf

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Multiple Column filter

    Done Alf, FD locked that thread after I submitted the request to lock this one, methinks a bit of confusification going on

    lamitche, please continue in this thread

    See if this helps, scroll down to the section for 'Or criteria'

    http://www.excel-easy.com/examples/advanced-filter.html
    Last edited by jason.b75; 07-01-2016 at 03:10 PM.

  9. #9
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,760

    Re: Multiple Column filter

    methinks a bit of confusification going on
    Yes I guess FDiddins was a bit confused as he probably has a lot on his mind but since:

    "It's human to err and divine to forgive"

    let's just forgive him.

    Alf

+ 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 one column with multiple checkboxes
    By pjohnson05 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 12-15-2021, 03:19 PM
  2. Multiple Column filter
    By lamitche in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2016, 02:02 PM
  3. Replies: 0
    Last Post: 04-03-2014, 11:41 AM
  4. Replies: 2
    Last Post: 03-31-2014, 03:23 PM
  5. Multiple Column Filter
    By kcaitch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2014, 11:17 PM
  6. [SOLVED] VBA for multiple filter criteria in one column
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2013, 11:41 AM
  7. Filter one column with multiple criteria
    By CBG05QB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-11-2011, 03:42 PM

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