+ Reply to Thread
Results 1 to 18 of 18

Picking data based on more than one dropdown options

  1. #1
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Picking data based on more than one dropdown options

    Hello there,

    Yet another obstacle I'm having trouble with, to which I know without a shadow of doubt you guys can help me with.

    Any help will be much appreciated.

    I am trying to source out a stream of data based on 3 dropdowns in the front sheet (attached). The dropdown can change criteria from user to user, e.g. client one can filter by Region only, Client 2 can filter to show Region and Segment and cluster and finally a Client would want to view the data as is (no Dropdown is selected). I've shortened the data source to view only a couple of lines, but there are 11000 entries. these entries consists of "Open" and "Lost" Values, which is also criteria i guess. Therefore two separate table will have to shown. I have tried to illustrate the result in the "Result" tab. Please do let me know if I'm unclear of what I'm trying to achieve.

    I thank you in advance

    F
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    A "prototype" VBA macro which filters data on your selection criteria,

    Additional logic is required for "blank" or "all" selection. Results are "DatA" filtered.

    RUN on "Front" tab.

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

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    Modified version to copy filtered data to tab "Filter"

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

  4. #4
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    Hi Thee John,

    THank you for your response, is there a way to do this with excel formals? I'm not so good with Macros.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    It could be done with formulae but with 11000 + rows it could be slow as you have to select (filter) data based on combinations of 3 (or 4 if we include "Open" /"Lost" as additional ) criteria.

    There is no need to "worry" about the macro: once installed you can forget about it.

  6. #6
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    Ah okay, I'll give this a go then , THanks for you your help.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    If you are not opposed to helper columns then we could ctreate columns as follows:

    1, 2, 3, 12, 13 ,23,123

    which represent choices 1/2/3 on their own , 1 and 2, 1 and 3, 2 and 3 etc. so 6 columns,.

    Concatenate the appropriate data in these columns in helper columns and the do "lookups".

    The attached is an updated VBA version where I include a blank line representing "All" in the drop downs: we could use "All" with a minor change to the code.

    Give it a try with a reasonable set of data.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    Thanks John,

    This is amazing, this might be a silly quesiton, but how do i assign this marco to my report?

    Thanks

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    Do you mean "how do you include the macro in your workbook"?

  10. #10
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    Sorry, that's what I meant

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    If "Developer" is not on the main menu ribbon then:

    Right click on "File" ==> "Customize the ribbon" and in the "Main Tabs" window select "Developer".

    Back in Excel:

    Click "alt+F11" to open the VBA editor

    Click "Insert" ==> "Module" and then copy/paste code into blank window on the right.


    To add RUN button:

    Back in Excel ...

    Click "insert" ==> Shapes ... Select a shape

    Right-click on shape

    "Assign macro" .. Window will open ==> Select macro then "OK"

    Right click on Shape ..

    "Edit text" ....RUN (or whatever you wish).

    Hope this (will) makes sense.

  12. #12
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    Thanks John much appreciated

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

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

  14. #14
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    Hi John,

    Quick question regarding the following section of the code you shared with me:
    If DD1 <> "" Then
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=10, Criteria1:=DD1
    Else
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=10
    End If

    If DD2 <> "" Then
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=7, Criteria1:=DD2
    Else
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=7
    End If

    If DD3 <> "" Then
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=6, Criteria1:=DD3
    Else
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=6
    End If

    can you tell me what this section is doing please?

    Thanks very much

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    If the selection criterion (from your drop down) is not blank then it executes the first line of the code (in red)

    If the selection criterion is blank, it executes the code in blue i.e selects everything for that column

    Field is the column Number (10="Cluster")

    If DD1 <> "" Then
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=10, Criteria1:=DD1
    Else
    ActiveSheet.Range("$A$1:$P$12").AutoFilter Field:=10
    End If

    these are your drop down selections:

    DD1 = .Cells(2, "B")
    DD2 = .Cells(3, "B")
    DD3 = .Cells(4, "B")

    The range $A$1:$P$12 needs to changed to your anticipated maximum e.g $A$1:$P$10000
    Last edited by JohnTopley; 11-16-2016 at 03:36 PM.

  16. #16
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    ah ok and the rang $A$1:$P$12 refers to the raw data in the data tab?I got confused because i had the range as A1:P14

  17. #17
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,709

    Re: Picking data based on more than one dropdown options

    the A1:P14 is right for the sample: I obviously hadn't changed the macro.

    You could make "Data" a dynamic name range and replace the $A$1:$P$12 reference with the named range

    e.g range("Data_Rng") where "Data_Rng" is the named range e.g A1:P10000 (static)..

  18. #18
    Forum Contributor
    Join Date
    07-21-2016
    Location
    London
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20806) 64-bit
    Posts
    108

    Re: Picking data based on more than one dropdown options

    fantastic, thanks John, I've learnt so much today. I need a good VBA tutorial haha

+ 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. Displaying differing data after picking from a dropdown menu
    By rgr in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-12-2016, 04:22 AM
  2. Submit options from dropdown menu and get data from website
    By zahoor1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2014, 06:31 AM
  3. Macro for picking options in a pop up window for table creation via sharepoint
    By DarthWire in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2013, 12:41 PM
  4. Replies: 6
    Last Post: 05-21-2013, 04:57 PM
  5. Cull dropdown list options based on selection in another dropdown
    By Kiffar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-20-2012, 01:53 AM
  6. Filter data using dropdown list options
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-02-2010, 05:06 AM
  7. offer dropdown options based on another dropdown
    By Conor in forum Excel General
    Replies: 2
    Last Post: 01-13-2006, 12:28 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