+ Reply to Thread
Results 1 to 5 of 5

Filter/Hide rows in a table based on drop-down selection?

  1. #1
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Filter/Hide rows in a table based on drop-down selection?

    Hi,

    I have a data table containing weeks of data. For instance:

    Week 1 100
    Week 2 343
    Week 3 454
    Week 4 293
    Week 5 120
    Week 6 129

    I also have a drop-down list (i.e. with data validation) where users can select a number between 1 and 9. I'd like to hide the contents of the table based on the user's number selection. So, if a user selects "4" in the drop-down, I'd like the table to only show Weeks 1 through 4.

    Any ideas how this could be accomplished? I tried conditional formatting but wasn't able to figure out the logic. I've attached a sample file to help illustrate what I'm trying to accomplish.

    Thanks!

    DynamicFilter_Example.xlsx

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Filter/Hide rows in a table based on drop-down selection?

    1) Highlight C13:D21. It's important that when all those cells are highlighted, C13 is the cell listed in the NAME BOX (left of the Formula Bar) as the primary anchor selected cell.

    2) Create a new Conditional Formatting Rule with following formula that changes the font to WHITE:
    =AND($D$6>0, $C13>$D$6)
    Attached Files Attached Files
    Last edited by JBeaucaire; 01-21-2015 at 10:53 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Filter/Hide rows in a table based on drop-down selection?

    I created an area that would be automatically populated with the number of rows that you call for in cell D6. The data is drawn from your sample in C13:D21. In C26 enter and fill down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This is an Array Formula:...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    In D26 enter this formula and fill down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Here is your workbook. You can test it out to see how it works.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: Filter/Hide rows in a table based on drop-down selection?

    Awesome solutions. Thanks to both of you!

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Filter/Hide rows in a table based on drop-down selection?

    Thank you for the feedback.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Hide/Unhide Rows Based On Drop Down Selection
    By QABrian in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-14-2014, 11:53 PM
  2. [SOLVED] How to hide & unhide rows based on selection from drop down box?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2013, 08:30 PM
  3. Replies: 1
    Last Post: 02-01-2013, 03:06 PM
  4. [SOLVED] Macro Filter to hide rows based on Drop Down List
    By dieseldogpi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-12-2012, 11:19 AM
  5. Hide certain rows based on drop box selection
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2010, 09:09 AM

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