+ Reply to Thread
Results 1 to 12 of 12

Dependent combobox to provide matching row count based on 3 criteria

  1. #1
    Registered User
    Join Date
    06-08-2017
    Location
    Chesapeake, Virginia
    MS-Off Ver
    2010
    Posts
    18

    Question Dependent combobox to provide matching row count based on 3 criteria

    I am looking to count the number of rows that match the criteria that will fall in linked cells for each of 3 comboboxes. I did not want to go the data validation route as I need the drop down to be clearly visible at all times and not when a cell is clicked.

    1. How would I dynamically be able to populate the combo boxes based on the previous selection(dependency)?

    2. How would I be able to count rows that match criteria on another sheet if 1, 2, or 3 columns match.

    I have provided an example spreadsheet. Any help is appreciated. I tried using SUMIFS, SUM(PRODUCT, and COUNTIFS but they did not produce the desired result. Any help is appreciated.
    Attached Files Attached Files

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

    Re: Dependent combobox to provide matching row count based on 3 criteria

    These are active-x controls, you can populate them with code.

    ActiveX codes are located in the sheet module, right click the sheet tab and select "View Code"

    See attached, select A1 to populate the 1st combobox, then when you make a selection the second combox populates

    The code looks like this,

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

  3. #3
    Registered User
    Join Date
    06-08-2017
    Location
    Chesapeake, Virginia
    MS-Off Ver
    2010
    Posts
    18

    Re: Dependent combobox to provide matching row count based on 3 criteria

    Thank you for your response. I see what you mean by using code instead of formulas.

    The second and third comboboxes populate with duplicate data when I select "Utah" in the first combobox for example. What would I change to make the list only show unique values?

    Also, How would I go about populating the "Matching rows" count to tell me how many rows contain matching data whether 1,2, or 3 comboboxes are filled out?
    Last edited by AliGW; 10-26-2017 at 09:32 AM. Reason: Unnecessary quotation removed.

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

    Re: Dependent combobox to provide matching row count based on 3 criteria

    You can change the combobox1 code
    Please Login or Register  to view this content.
    Use this formula to find the matches of all three comboboxes, it uses the linked cells you have for the comboboxes
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-08-2017
    Location
    Chesapeake, Virginia
    MS-Off Ver
    2010
    Posts
    18

    Re: Dependent combobox to provide matching row count based on 3 criteria

    The combobox works perfectly now, thank you. The formula will only work if all 3 comboboxes are filled out. What I am trying to do is enter for example "Utah" and leave the other 2 boxes blank. The number should be 4. But if I put in "Utah" and "455" for the building while leaving the room blank the number would be 3 because there are 3 unique rooms in that building and so on. Maybe I am not explaining it right?
    Last edited by AliGW; 10-26-2017 at 09:34 AM. Reason: Unnecessary quotation removed.

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

    Re: Dependent combobox to provide matching row count based on 3 criteria

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-08-2017
    Location
    Chesapeake, Virginia
    MS-Off Ver
    2010
    Posts
    18

    Re: Dependent combobox to provide matching row count based on 3 criteria

    I must not be explaining it right. I am not looking for options for 1, 2, or 3 counts. I am looking for one cell that will differentiate whether I have selected a location only or a location and a building or a location, building, and room. There are 3 examples in the sample file I posted at the beginning of this thread.
    Last edited by AliGW; 10-26-2017 at 09:33 AM. Reason: Unnecessary quotation removed.

  8. #8
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,434

    Re: Dependent combobox to provide matching row count based on 3 criteria

    Ghostrider757 - please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.
    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.

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

    Re: Dependent combobox to provide matching row count based on 3 criteria

    You should be able to figure it out with the formulas I gave you.

  10. #10
    Registered User
    Join Date
    06-08-2017
    Location
    Chesapeake, Virginia
    MS-Off Ver
    2010
    Posts
    18

    Re: Dependent combobox to provide matching row count based on 3 criteria

    If I was able to figure it out, I wouldn't be asking for help. The formulas you provide are for 3 separate cells and similar to the one I already have on my master copy. I need one formula for one cell that will provide a result based on all 3 scenarios. I really appreciate the help but it seems we are going in circles.

  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
    28,363

    Re: Dependent combobox to provide matching row count based on 3 criteria

    Try ("generic " formula)

    =COUNTIFS($A$1:$A$13,IF(D1<>"",D1,"*"),$B$1:$B$13,IF(E1<>"",E1,"*"),$C$1:$C$13,IF(F1<>"",F1,"*"))

    See attached for example

    Works ONLY (on my testing) if fields are defined as TEXT
    Attached Files Attached Files

  12. #12
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Dependent combobox to provide matching row count based on 3 criteria

    Quote Originally Posted by JohnTopley View Post
    Try ("generic " formula)

    =COUNTIFS($A$1:$A$13,IF(D1<>"",D1,"*"),$B$1:$B$13,IF(E1<>"",E1,"*"),$C$1:$C$13,IF(F1<>"",F1,"*"))

    See attached for example

    Works ONLY (on my testing) if fields are defined as TEXT
    John can it be more simple.

    Like
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    CSE
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

+ 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. Replies: 3
    Last Post: 08-24-2017, 05:59 AM
  2. [SOLVED] Hide and Unhide a Combobox based on Criteria met in another Combobox
    By BONCH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2017, 08:13 PM
  3. Replies: 0
    Last Post: 03-01-2015, 11:34 PM
  4. Dependent Combobox based on Option Buttons
    By Sway1978 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-06-2013, 04:18 PM
  5. How to provide a value based on multiple criteria.
    By hotelier in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-10-2013, 10:26 AM
  6. [SOLVED] Dependent drop down list based on matching data
    By CUNLA in forum Excel General
    Replies: 4
    Last Post: 10-09-2012, 03:24 PM
  7. Count unique values based on matching criteria
    By gromitw in forum Excel General
    Replies: 9
    Last Post: 01-10-2007, 08:59 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