+ Reply to Thread
Results 1 to 10 of 10

Using a drop-down to filter data

  1. #1
    Registered User
    Join Date
    04-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    86

    Using a drop-down to filter data

    Hey guys

    Say if I have four columns of data. I want to sort the data by the first column, but instead of the column header I want to be able to pick the value from a drop down in a cell which is in a different column..

    What would be the best way to go about that?

    Thanks in advance!!

  2. #2
    Registered User
    Join Date
    02-26-2010
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2007
    Posts
    55

    Re: Using a drop-down to filter data

    Can you use the built-in filter feature in Excel?

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Using a drop-down to filter data

    So what you're asking is if your data is in A:D, you want a dropdown in, say, E1 which lists all unique values in column A and then when you chose a value, Excel filters based on that value in A?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Using a drop-down to filter data

    So, which is it you want to do: Sort the data per your thread description or Filter the data per your thread title?

    You cannot perform sorting use a drop down, but you can do so with filtering.

    I want to be able to pick the value from a drop down in a cell which is in a different column
    In the drop down cell, you will need to use Data Validation with the list option.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  5. #5
    Registered User
    Join Date
    04-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Using a drop-down to filter data

    Hey guys - to clarify - I want to sort four columns of data based on a dropdown in a cell. ChemistD has it pretty much right. So the drop down has four options, say A, B, C, D. If pick 'C' for example, I want the four columns of data to display all rowns with 'C' in column A


  6. #6
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Using a drop-down to filter data

    to clarify - I want to sort four columns of data based on a dropdown in a cell
    As I stated, sorting using a drop down is not possible - thus, you want to filter data.

    Here is the basic code. See attached example.
    This will filter on column-A whenever a selection from the drop down is made in B1. To clear the filter and see all values, simply delete the value in B1.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Using a drop-down to filter data

    You'll need to use VBA to do that. Right click on the tab and "View Code" and paste this in
    Please Login or Register  to view this content.
    where H1 is the cell which you are designating for your dropdown choices and $A$1:$F$20 is your table (including header). Modify accordingly. Does that work for you?

  8. #8
    Registered User
    Join Date
    09-04-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Using a drop-down to filter data

    Hello,

    Can you give me an example that sorts several variables out? Your example allows for the sorting based off of one input, I would like to sort several times based on my inputs. Similar to what you have here, but several drop down menus with several choices in other columns... So a filter that I control using the drop down menus.

    Thanks,
    J

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Using a drop-down to filter data

    Hello snydercmc, and welcome to the forum.

    Unfortunately you have inadvertently broken one of the forum rules. Please read the following and make the necessary change. Thanks.

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

  10. #10
    Registered User
    Join Date
    04-01-2014
    Location
    United States
    MS-Off Ver
    2010
    Posts
    1

    Re: Using a drop-down to filter data

    Is there a setting that I need to change in Excel. I tried this code and it didn't work in my sheet. I opened up your file, without changing anything, and it still didn't work.

+ 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