+ Reply to Thread
Results 1 to 9 of 9

Populating a list based on two variables, excluding entries which are blank

  1. #1
    Registered User
    Join Date
    06-10-2012
    Location
    Japan
    MS-Off Ver
    Excel 2010
    Posts
    13

    Populating a list based on two variables, excluding entries which are blank

    Hello all,

    I have a problem which a few hours of googling and playing with formulas has not seemed to have turned up any results.
    Although the details are in the attached spreadsheet I shall explain anyway.

    I am attempting to populate a list (on the first tab) based on two variables.
    One being the type - Expressed by columns of data in the second tab with a data-validated drop down menu on the first tab.
    The other being that the word "Yes" appears in the row matching the type.
    With all values not meeting these criteria (ie. blank spaces) excluded from the populated list.

    A simple example would be as follows.

    Name..........Standard..........Standard +..........Art

    The A...............Yes................Yes......................
    Big B.....................................Yes.................Yes
    Mr C.................Yes......................................Yes

    When "Standard" is selected from the dropdown menu on the first tab, the list populates as so...
    The A
    Mr C

    When "Standard +" is selected from the dropdown menu on the first tab, the list populates as so...
    The A
    Big B

    When "Art" is selected from the dropdown menu on the first tab, the list populates as so...
    Big B
    Mr C

    If at all possible I would like to avoid VBA and work it out with formulas.


    Here is the example sheet.
    NCL Example.xlsx


    If there is anything that needs clarification then please let me know.

    Thank you in advance,


    Perth Excel

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

    Re: Populating a list based on two variables, excluding entries which are blank

    In Application Data M4 dragged down (you can hide this column later)

    =IF(INDEX($D4:$L4,MATCH(Main!$G$7, 'Application Data'!$D$3:$L$3,0))="Yes",COUNT($M$3:M3)+1,"")

    In Main B11, dragged down

    =IF(ROW(A1)>COUNT('Application Data'!$M$4:$M$29),"",INDEX('Application Data'!$B$4:$B$29,MATCH(ROW(A1),'Application Data'!$M$4:$M$29,0)))
    See attached. Does that help?
    Attached Files Attached Files
    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

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Populating a list based on two variables, excluding entries which are blank

    Perth Excel,

    Attached is a modified version of your posted workbook. I made several changes to layout to make it more Excel-friendly. You'll notice there are no skipped columns in the 'Application Data' sheet. Row 1 is used for headers, and data starts in column A. I made very minor changes to the layout of sheet1. Mostly I just removed the merged cells portions because they are unnecessary.

    With the layout now in a more Excel=-friendly format, I created three dynamic named ranges. The first one is for the list of application names. The second one is for the types of installation. The third one is for the table of resulting data in the sheet 'Application Data'.

    For the list of application names, named list_Names:
    Please Login or Register  to view this content.

    For the types of installation, named list_Types:
    Please Login or Register  to view this content.

    For the resulting table of data, named tbl_Data:
    Please Login or Register  to view this content.

    Then, in the Main worksheet, in cell C4 is a data validation drop down using the named range list_Types.
    In cell C6 and copied down is this formula:
    Please Login or Register  to view this content.

    Now when you select a different item from the Type of Installation drop-down, the Application List will show the items for that type. You can add to the table in the sheet 'Application Data' and the additional information will be automatically picked up by the dynamic named ranges.
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

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

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Populating a list based on two variables, excluding entries which are blank

    Hello there,

    Attached is a macro version. I prefer to use macros as they are able to function correctly even when your lists grow and categories are added.
    Attached Files Attached Files

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Populating a list based on two variables, excluding entries which are blank

    rvasquez, dynamic named ranges allow for that same functionality also.

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Populating a list based on two variables, excluding entries which are blank

    Thank tigeravatar, I had tried your workbook and I guess I just added it below the last Category instead of inserting it and it didn't work. But it does if you insert it.

    Thanks again! Good to know!

  7. #7
    Registered User
    Join Date
    06-10-2012
    Location
    Japan
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Populating a list based on two variables, excluding entries which are blank

    @ ChemistB - Thanks for the quick response this is just what I was looking for!
    @ tigeravatar - I had tried named ranges (and had them as named tables as well with the ranges pointing to these as to make them dynamic named lists) but i just couldn't figure out the forumla. The spaces were helper columns I was using from a different project but I realised I couldn't use them in this one after i tried it. As for the merged cells in the first tab, That was merely for User Friendliness (and because I planned on adding more features later based on this methodology).
    @ rvasquez - I was trying to avoid VBA / Macro's as I don't have much experience with them, and I find working out what is going on in formulas easier if I come against a problem but your solves the problem as well. I eventually want to learn how to programm VBA / Macros, any idea's on quick learning resources?

    Thanks everyone for your hard work (or easy if you found it simple). + Reputations all round and SOLVED (3 different ways).

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

    Re: Populating a list based on two variables, excluding entries which are blank

    @ Perth Excel

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

  9. #9
    Registered User
    Join Date
    06-10-2012
    Location
    Japan
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Populating a list based on two variables, excluding entries which are blank

    @Cutter - Apologies, I had tried to unsuccessfully many times but under the thread thools where I usually have "Mark as Solved" it read "Mark as Unsolved". However many times I refreshed the page, deleted browser cookies etc. I could not get it to change. Not sure if this is possibly a bug or my computer having a bad day. Nevertheless I have managed to do this now (after another three rounds of the same "Unsolved" instead problem as yesterday).

+ 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