+ Reply to Thread
Results 1 to 25 of 25

Checkbox Filter on more than one Column

  1. #1
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Checkbox Filter on more than one Column

    Hello Seniors and more particularly @jaslake

    BACKGROUND
    Worksheet PEF has about 14 check boxes (ACTIVE X control, and not Form Control based CheckBox)

    Row 1 to 7 (Range B2:N7 ) is just prepared to have a sort of Dashboard for User to select criteria and filter data

    Row 8 will always remains as Header.

    Worksheet would have n number of rows which would keep chaning periodically, currently it has data from Row 8 to 2882

    Data range (Row:Column) would keep chaning but always start from Row 9 to say current level or 3,000 or 4,000 or 8000 etc.,

    In terms of Column currently, data is upto Column AL , in future, it may expand.

    Other Notable
    Data in Column A:Q mostly would remain static (import from other sources like SQL etc.,).
    Data in Column Q:AL keep contracting / expanding in terms of Rows and Column.

    However, title in Column Header in Row 8, from Column Q onward would be similar to TEXT result in respective Column Cell thereunder.

    Illustration, Currently Column AJ8 header is 'status' and so is the result in same column at many cells,
    Likewise Column AK8 Header is 'Water', and so is the content of many columns in Column AK

    So each Column header (from Q to AL currently) should have pre-assigned CheckBox (ActiveX Control) and upon Tick (TRUE) should be filtered.
    So say, when Col AJ is fitlered on 'status' later when ColAK is filtered on 'Water' it should sub filter data, having result of Column AJ, and so on.

    When selected all, all other checkbox should be unticked and all data be made visible / unfiltered.

    First CheckBox1 is assigned ALL to mean, if ticked or so, all Data should be unfiltered, all data should be visible.

    So it is like Filtering on one criteria in One Column, then applying sub-filter selecting other check box in other Column, which again would be sub-filtered by ticking third check box on third column etc and so on

    Order of selecting Checkbox could be anything.

    What I really want is that based on criteria specified in several columns, and linked to checkboxes, want to filter data.
    Taking Clue from this thread, I tried to replicate but have messed up grossly somewhere.
    HTML Code: 
    Idea is to filter data based on wherever Checkboxes are tikced (True), it could be sequentially or otherwise

    Summary
    Clear All chkBoxes to unfitler data and show them all.
    Select one ChkBox, hold that value,
    Select second ChkBox and sub-filter on that value, keeping results in above
    Select third ChkBox and sub-filter on that value, keeping results in one and two above
    and so on and so forth.

    Criteria selection could be in any direction, like User

    While Filter, and Sub-filter is applied, Header Dropdown visibility should be FALSE, it should not display any dropdown filter list, if possible.

    Sample Workbook with code from above Forum thread as attempt is given in attached file.

    P.S.: Filter could be on one criteria or on multiple criteria and not just with basic as was the case in Column B of other forum thread mentioned herein above.
    Last edited by AliGW; 07-10-2019 at 02:34 AM. Reason: Message reinstated.

  2. #2
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Addititional Info : Each CheckBox should be earmarked for one Column only which would have only unique value to filter in from a respective Single Column, holding values from previously filtered columns.
    'All' should un-filter all columns, i.e. show all data. So, when a each checkbox for a respective column is ticked it should be filtered, on second click of checkbox in either order, it should sub-filter the data further, and so on. Likewise, when a filter is un-ticked, it should remove filters and show data accordingly.

    Illustration: Show all data.
    Filter on Column, P,
    from above result, further Filter on Column Z,
    From above two result, further filter say on Column S,
    From above three result, further filter say on Column T

    Now say, User wants to remove filter from Column S and when unticked, it should show filtered data from Column, P, Z and T (If this is not doable, No Problem, I/User will untick all, show all data and would re-filter based on specific requirement, column, after column)

    Thanks
    Last edited by AliGW; 07-10-2019 at 02:35 AM. Reason: Message reinstated.

  3. #3
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Seems I have written in a way that Experts/Seniors are unable to understand my query, so instead of creating new thread, i will post a new query here on same subject with minimum description to the point. So, I have removed sample file from #1. Thanks

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: Checkbox Filter on more than one Column

    Why have you removed the sample file?

    Please pose your question again, but in no more than a few lines. Experience tells me that very verbose queries, like yours above, often go unanswered: there's just too much to wade through.

    Please don't start a new thread - continue here.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Kindly Ignore Post in #1 and #2. I have tried to keep it simple (i could go wrong again). Giving Background clarification to keep code flexible and avoid further questions. Here I re-write what i seek.
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    WORKSHEET DATA SETUP
    Worksheet 'PEF' has about 14 ActiveX check boxes . Each Checkbox, except first is dedicated for unique Column to Filter data based on Key Text/Number from respective Column. Row 1 to 7 would act as Dashboard for User to apply selective filter using CheckBox. Row 8 is Header. Data size would vary.

    Want to Filter DAta Columns through CheckBox
    CheckBox1 When Selected , all other CheckBox should be unselected, and All Data should be unfiltered, showing All Data in worksheet.

    When any CheckBox other than CheckBox1 is selected, CheckBox1 should automatically be un-ticked and apply filter on that Checkbox and Other but other than CheckBox1.

    Column Q onward each Column would have unique word/value, based on which Data has to be filtered from respective Column via CheckBox 2 to n Chackboxes.

    Currently, Column AJ8 has header 'Status' and be assigned to CheckBox2. Rows in Column AJ would have only unique text 'Status' which has to be filtered. So, when CheckBox2 is Ticked / Selected entire data from Row 9 onward with adjacent Columns should be filtered on Column AJ having keyword ' Status'.

    Next, Say, Column AK8 Header is 'Water', CheckBox3 be assigned and content in Column AK8 should be filtered, if Row Cell has value 'Water'.

    Say, If CheckBox2 (captioned 'Status') when Ticked (True) assigned / dedicated to Column AJ, should filter data wherever Cell Content inside Column AJ is 'Status'.
    While data is filtered as above, Say, we want to filter it further, and we tick CheckBox3 (captioned 'Water') assigned to Column AK, should filter data wherever Cell Content inside Column AK is 'Water'. So Filter is now on Column AJ having word 'Status' and Column AK having word 'Water'.

    So on and so forth.

    When ChekBox1 (captioned 'All') is ticked all other Filtered data should be removed. .ShowAll

    I saw this thread and think code is very close to my query, but could mot tweak it to my requirment.

    HTML Code: 
    Seek a suitable VBA Sample Code to do above for two Columns (AJ, AK) for Filtering and CheckBox1 to show all data, as explained above, with a flexibility, such that I could do rest of the work for other Columns/chkBox.

    Sample Workbook is attached with Basic Code assigning CheckBox Value in worksheet 'PEF' which would call upon other Procedure named as FilterD' to apply filter when ticked/checked.
    Attached Files Attached Files
    Last edited by analystbank; 07-09-2019 at 05:22 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: Checkbox Filter on more than one Column

    That's not simple!

    Please summarise what you are trying to achieve in no more than five lines.

    Administrative Note:

    Although we value privacy as much you do, it could be important that members have a rough idea of your location as the solutions they offer may be affected by your locale. For instance, you might in the future post questions which are related to your regional settings.

    With this in mind, please update your profile to something more precise (something such as UK, Europe, USA, etc. will suffice).

    Thank you for helping us to help you.

  7. #7
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    @AliGW, Respected M'am.

    Ok, noted, I am editing my post and doing other as suggested.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checkbox Filter on more than one Column

    Hi analystbank

    What Columns do the various Checkboxes relate to??? For example, I can see that...
    • Checkbox2 relates to Column AJ (status)
    • Checkbox3 relates to Column AK (water)
    • Checkbox 5 relates to Column AG (vxx)
    • None of the others make any sense to me...

    Amended...I downloaded your most recent attachment...need to look at it...will get back to you. If you have additional clarification please provide it...
    Last edited by jaslake; 07-09-2019 at 04:08 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  9. #9
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Thanks Sir,
    Checkbox2 relates to Column AJ (status), Column AJ has few Cells with word 'status' and most others are blank, CheckBox2 has to filter only rows where cell content in Column AJ has word - status

    Checkbox3 relates to Column AK (water) - Column AK has few Cells with word 'water' and most others are blank, CheckBox3 has to filter only rows where cell content in Column AK has word - water

    Checkbox 5 relates to Column AG (vxx) - Column AG has few Cells with word 'vxx' and most others are blank, CheckBox5 has to filter only rows where cell content in Column AG has word - vxx

    You are right in your observation Quote"None of the others make any sense to me..." Unquote. Currently, I am just trying with three columns and once its build correctly, I want to have flexible code whereby, I will do for rest of the Columns with corresponding assigned CheckBoxes and unique word in corresponding other Columns linked to respective CheckBoxes. CheckBox1 is reserved to CLEAR ALL Filters and show all data within worksheet.

    When second , third and so on Filter is applied through selecting Checkbox, It should hold the filtered values from the previously applied filter. As in present case, When CheckBox2 is applied Column AJ is filtered with Word 'Status', when CheckBox3 is ticked/selected while holding filtered results of 'status', it should narrow down / further filter on additional word water in Column AK, etc
    Last edited by analystbank; 07-10-2019 at 02:43 AM.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: Checkbox Filter on more than one Column

    Analystbank - do NOT remove previous messages in the thread. That is not helpful at all and it makes subsequent posts hard to follow and understand.

    Moderators will reduce clutter in a thread if they see fit - please do not take this upon yourself in future.

    I have reinstated the messages you removed. Leave them alone, please.

  11. #11
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Yes, M'am I had deleted previous posts to avoid noise and had kept only the valid query to focus upon and save time of seniors. Thanks.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: Checkbox Filter on more than one Column

    I know why you did it. My point is that you should not have done so.

  13. #13
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Noted, will take care going forward.

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checkbox Filter on more than one Column

    Hi analystbank
    I'll attempt to make Code to work on Checkboxes 1,2 and 3. The project is too ill defined for further involvement.
    I'll get back to you...

  15. #15
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Thanks Sir,

    I re-try

    CheckBox1 to show all data (*unfilter all)
    Checkbox2 assigned to Column AJ and should filter wherever Cell content in Column AJ has word status
    Checkbox3 relates to Column AK and should filter wherever Cell content in Column AJ has word water
    Checkbox 5 relates to Column AG and should filter wherever Cell content in Column AJ has word vxx

    So, essentially, each CheckBox is earmarked and suppose to filter on a single Column.

    Where more than one Checkbox is selected , it should filter and sub-filter on those criteria. Sample given for three column for simplicity, and rest i would try to replicate for other checkboxes with corresponding columns.

    So, with three or four Criteria and ticked Checkboxes, User should be able to see filtered results. When any of this Checkbox is later unticked, it should show filtered values for only ticked Checkboxes

  16. #16
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checkbox Filter on more than one Column

    Hi analystbank
    I've rewritten the Code such that it Filters the appropriate Column(s) based on the selected Checkbox Captions. The Code as presented accommodates ONLY CheckBox1, CheckBox2 and Checkbox3.
    If you require further assistance let me know.
    HTML Code: 
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Simply Superb, Sir. This is what exactly, I was looking for.

    Just in case my workbook checkboxes expand beyond 14, i should be able to do tweaking to following lines inside Procedure 'Update_CheckBoxAll'? What this Procedure does actually ?

    Please Login or Register  to view this content.
    Last edited by analystbank; 07-12-2019 at 06:41 AM.

  18. #18
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checkbox Filter on more than one Column

    Going to bed Bud...it's 1:30 AM here...I'm an old man...you have additional quires please post them...I'll perhaps respond tomorrow...

  19. #19
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Sir, I have added additional filters by activating other checkboxes, and it works like a charm.
    Last edited by analystbank; 07-12-2019 at 05:12 AM.

  20. #20
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Quote Originally Posted by jaslake View Post
    Going to bed Bud...it's 1:30 AM here...I'm an old man...you have additional quires please post them...I'll perhaps respond tomorrow...
    Oh, No hurry, Have a peaceful sleep, reply at your comfort. Good night, Sir, and Thank you very much. I await for clarification for Post #17.
    Last edited by analystbank; 07-12-2019 at 05:13 AM.

  21. #21
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checkbox Filter on more than one Column

    Quote Originally Posted by analystbank View Post
    Simply Superb, Sir. This is what exactly, I was looking for.

    Just in case my workbook checkboxes expand beyond 14, i should be able to do tweaking to following lines inside Procedure 'Update_CheckBoxAll'? What this Procedure does actually ?

    Please Login or Register  to view this content.
    That Code cycles through ALL Check Boxes from Checkbox2 through CheckBox14 and unchecks them (sets them to FALSE)..If you were to ADD additional Check Boxes simply change 14 to the new upper limit. Make certain that they are numbered sequentially or error handling will need to be added.

  22. #22
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checkbox Filter on more than one Column

    Quote Originally Posted by analystbank View Post
    Sir, I have added additional filters by activating other checkboxes, and it works like a charm.
    Good...glad it works for you.
    You're welcome...glad I could help.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  23. #23
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Quote Originally Posted by jaslake View Post
    That Code cycles through ALL Check Boxes from Checkbox2 through CheckBox14 and unchecks them (sets them to FALSE)..If you were to ADD additional Check Boxes simply change 14 to the new upper limit. Make certain that they are numbered sequentially or error handling will need to be added.
    Sure, i will try to ensure that additional checkboxes are added sequentially, if and when needed, but if sometime it could not be managed and are not sequential, what code could be added to handle error, if you can provide, please. Would simple,
    Please Login or Register  to view this content.
    would not suffice ?
    Last edited by analystbank; 07-13-2019 at 03:28 AM.

  24. #24
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checkbox Filter on more than one Column

    Quote Originally Posted by analystbank View Post
    Sure, i will try to ensure that additional checkboxes are added sequentially, if and when needed, but if sometime it could not be managed and are not sequential, what code could be added to handle error, if you can provide, please. Would simple,
    Please Login or Register  to view this content.
    would not suffice ?
    Try it...see if you like it...sequential is the simple, safe approach...

  25. #25
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Checkbox Filter on more than one Column

    Certainly, simplicity inbuilt is way to keep things easy. Would ensure to have sequential only. Query was just asked, to know to preclude recurrence of question after long time in future. Thanks, Sir.

+ 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. Checkbox & Filter & No FALSE/TRUE
    By halama in forum Excel General
    Replies: 1
    Last Post: 01-22-2019, 04:40 PM
  2. Userform CheckBox State Filter
    By rbirch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-23-2016, 10:52 PM
  3. Use Checkbox and Combobox as filter
    By charleswang in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-06-2015, 08:31 PM
  4. checkbox to filter columns with a specified value
    By Rupesh.Sharma in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2014, 09:18 AM
  5. Replies: 0
    Last Post: 04-07-2014, 12:22 PM
  6. Filter by Checkbox
    By robbiekh in forum Excel General
    Replies: 2
    Last Post: 11-04-2013, 03:17 PM
  7. Checkbox With Filter Problem
    By jackgan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-14-2013, 04:06 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