+ Reply to Thread
Results 1 to 20 of 20

Filter Results Shown In Data Validation List

  1. #1
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Filter Results Shown In Data Validation List

    My earlier post on this subject did not yield me an answer, so I am trying again. Here is the link to that post “Add Filter To Cascading Combo Boxes”. I hope it's not bad practice to start a new post instead of continue the old one. If it is, then I hope someone merges these threads instead of deleting this one.

    This time instead of posting my real spreadsheet, I am posting a much simpler example, hoping for a better response.

    Please download the attached example spreadsheet. On the workbook “Main” you will see cell “D2” is highlighted in yellow. That combo box (based on a data validation list) shows all the divisions that can be chosen. If you go to the workbook “CSI” you will see a sample of the data that I am working with. Each row of data that starts with a “00” is in Division 00, and each row that stars with “01” is in Division 01, etc.

    Once a division is chosen in cell “D2”, then cell F2 looks up a named range. Then the green cells (D6 through D15) are limited to only those items that fall within the division that is chosen in cell “D2” by use of the data validation formula “=INDIRIECT($F$2)”

    I am looking for a way to filter the results of these second combo boxes (data validation lists D6-D15) further. Instead of showing all the results of the named range which is shown in cell “F2” I would like it filtered. The filter would be based on whether or not the last column of data for any given row has a “1” in it. It doesn't have to be a "1", I'll accept any way that you can make this work. I am just using a "1" for this example. Whether or not a row contains a "1" in column "J" will change from time to time, and I am thinking that this will be an easy way to indicate, or flag, whether or not a row is "Preferred", but I'm open to other suggestions.

    If the cell in that row, row “J” on worksheet “CSI”, contains a “1” then I would like it to be displayed in the data validation lists in cells D6 through D15. If the cell for that row of data is blank then I do not want it to show up in the data validation list combo box.

    To complicate this further, I would like a way to easily switch this filter on and off. I imagine this would filter would be turned on or off based on what is selected in an option button group (like I’ve got highlighted in blue in cell “D4”, whose results are tied to cell F4), or through an additional combo box or data validation list.

    I'm pretty stuck from moving forward on this project until I get over this hurdle, so I appreciate and help you can provide.

    Thanks, Spence
    Attached Files Attached Files

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Filter Results Shown In Data Validation List

    Generally, you should not be starting a new thread... but I see that the other one has lead to some confusion... so perhaps this time you can show the link to this thread in the other one so that the responder(s) know that you have continued elsewhere in case they may want to continue assisting you... or so that others don't answer over there....
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Quote Originally Posted by NBVC View Post
    Generally, you should not be starting a new thread... but I see that the other one has lead to some confusion... so perhaps this time you can show the link to this thread in the other one so that the responder(s) know that you have continued elsewhere in case they may want to continue assisting you... or so that others don't answer over there....
    Done, thank you.

  4. #4
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Filter Results Shown In Data Validation List

    See attachment.
    Attached Files Attached Files

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Filter Results Shown In Data Validation List

    Glad to see you haven't abandoned your original project!

    In an effort to understand your requirements I amended some of your formulae to simplify matters, to me at least.

    With Sheet "Test"
    In A5
    Please Login or Register  to view this content.
    In B5
    Please Login or Register  to view this content.
    These return the headers according to your Option Buttons

    In A6
    Please Login or Register  to view this content.
    In B6
    Please Login or Register  to view this content.
    Drag/Fill both Down to Row 35

    These last two return Data based on your selection in Column C and your choice of radio button.

    There are other changes which may not be relevant now.
    1/. Dynamic named list "DIV_NAMES"
    2/. Changed Layout to Sheet "Names"
    3/. Minor changes to named lists, most still in progress, now halted.

    I was trying to analyse why you were using data forms.
    Have you given up on this approach?

    I see WHER has replied to this thread, I'll wait for your response before proceeding further, I did say that your original request would take some time to understand.

    This attachment refers to your original thread
    Attached Files Attached Files
    Last edited by Marcol; 12-21-2010 at 02:57 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    WHER, thank you for taking the time to come up with a solution. I'm not familiar with a lot of the logic you are using, so it will take me a while to try and absorb it. It does seem to work great.

    Thanks, Spence

  7. #7
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Marcol, thanks for still working on this. I wasn't sure if you had given up or not. Those first four formulas you are showing make great sense and are definately a lot cleaner than the way I was doing it before.

    I had not given up on using the Data Form as a search method. I just wanted to make the example in this post as simple as possible so I could potentially get a solution for my main roadblock which is filtering the data validation list.

    I love how you got the Data Form to appear right on the "Test" workbook, instead of having to go look at the blank "Find" workbook like I was doing.

    I'm not sure what you are doing with the EditOptionLevels macro, so please let me know what your intentions were there.

    Do you have any suggestions on filtering the data validation list, or is the method that WHER is suggesting going to be my best bet?

    Thanks, Spence

  8. #8
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Quote Originally Posted by WHER View Post
    See attachment.
    I've tried to reverse engineer your logic, but there are too many functions in your formula that I haven't used before to try and grasp all at once.

    From what I can understand, your approach is quite clever because you are using the values of the data itself to get the results. I have been focusing on finding a solution that involves my named ranges, but you don't seem to need to with your method.

    I don't want to use a formula that I don't understand, so although you have created a solution to my problem, I'm going to have to keep looking for a different solution, or give up on my idea of being able to filter this data validation list until I can take the time to learn everything that you have going on in that formula.

    I will keep trying to learn what you have showed me, I just don't have the time right now that it looks like it would take me to figure it out before I complete this spreadsheet.

    Do you have another solution that would work if my data was not formatted so nicely? Where you couldn't rely on the contents of the data in column "A" and had to rely on the named ranges and whether or not there was a "1" in column "J"?

    Once again, I thank you for your proposed solution.

    Spence

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Filter Results Shown In Data Validation List

    Remember time zones, where are you located?

    Everybody on this forum gives time, and ideas, free gratis and for nothing....

    Have a little patience...

    I intend having a further look later today (23-Dec-10) during normal UK times

  10. #10
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Filter Results Shown In Data Validation List

    Hi Spence,

    I tried creating a similar formula, using your named ranges but didn't succeed.
    My existing formula's should still work if the data in column A would not be nicely grouped, as they are now.

  11. #11
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Quote Originally Posted by Marcol View Post
    Remember time zones, where are you located?

    Everybody on this forum gives time, and ideas, free gratis and for nothing....

    Have a little patience...

    I intend having a further look later today (23-Dec-10) during normal UK times
    Marcol, I understand and appreciate what you are saying. I am trying to be patient, it's just that I'm getting desperate. If I don't come up with a solution to easily filter all these 7,314 rows, then my boss will insist I just delete the one's we think we don't need.

    I know that will lead to regret down the road, so I'm on a mission to "save the data".

    I am located in Michigan, in the United States. I'll go edit my profile to reflect that. It would be a nice feature if under the area where it shows each posters location it would also show their local time in relation to ours.

    I appreciate your continued assistance and look forward to your next reply. Even though I couldn't totally understand everything that WHER had done in his formula, it did give me some ideas on a different approach to take. I'll outline those below in my reply to him. Please take a look at that before you spend more time on this.

    Thanks, Spence

  12. #12
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Quote Originally Posted by WHER View Post
    Hi Spence,

    I tried creating a similar formula, using your named ranges but didn't succeed.
    My existing formula's should still work if the data in column A would not be nicely grouped, as they are now.
    WHER, I meant if they didn't have the series of numbers, or if the text description was first, but either way, for this project I think you have convinced me to take advantage of the data being the way it is.

    I will end up having at least 16 worksheets like “Main” that all feed off of the "CSI" worksheet data. I don't think I explained that in this post as I did in my original post, so my apologies for not giving you enough information. I was trying to give a much simpler example than in my first post, but I guess I went too simple.

    With having multiple worksheets which will for the most part all be dedicated to different divisions, I don't think your logic in column "M" will accommodate all of them. If worksheet "01" deals with division "01", and worksheet “02” deals with division “02”, I don’t think what is happening in column “M” can handle that. So unless I’m not following, we would need a different column “M” for each worksheet.

    Your logic got me rethinking my strategy though and I think I may have a simpler (or at least simple-minded) approach. Please see this new spreadsheet “Example 2” that I have attached.

    I’ve put a simple formula in column “K” which only copies over the “2010 Code And Description” (Column “A”) for those items which I have identified as being “Preferred” by placing a “1” in column “J”.

    Where I need help next is to get column “L” to condense the preferred items in column “K” by removing the blanks. I know somewhere in your originally proposed formula you are achieving this somehow, because your items in your column “M” are organized that way. I can’t extract that method from your formula though, as that logic is above my current security clearance level.

    Let’s say you could propose a formula to condense my items in my column “K” into column “L". Then look at my data validation formula for cells D6-D15. That formula works in the sense that it filters my choices in the data validation list when I have my option button set to “Show Only Preferred Results”.

    The problem is that it shows the preferred results, or all results, from all divisions. I’m not sure if it is possible to put some sort of “ISERROR” or other functions like "Index" and "Match" in the data validation formula which would limit the results shown to only those items whose first two digits matched up to the 10th and 11th digits in cell “D2”, by using the MID and LEFT functions similar to your originally proposed formula.

    I know I’m looking at this from my limited knowledge base, so I may be way off in my thinking. I believe this approach though, would keep my “CSI” worksheet fairly static. It would only change when I went in and changed the status of an item to Preferred or Not Preferred by placing or deleting a “1” in column “J”.

    Please let me know your thoughts,
    Spence
    Attached Files Attached Files
    Last edited by Spencer; 12-22-2010 at 11:31 AM.

  13. #13
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Quote Originally Posted by Spencer View Post
    Marcol, thanks for still working on this...

    I had not given up on using the Data Form as a search method. I just wanted to make the example in this post as simple as possible so I could potentially get a solution for my main roadblock which is filtering the data validation list.

    I love how you got the Data Form to appear right on the "Test" workbook, instead of having to go look at the blank "Find" workbook like I was doing.


    Thanks, Spence
    Marco, I played around a bit more with the Data Form last night. It's great to have it show up on the "Main" worksheet instead of the "Find" worksheet. It would also be great if I could eliminate the "Find" worksheet altogether as that makes the file size of the spreadsheet unnecessarily large.

    The reason I created the "Find" worksheet in the first place was that I wanted the Data Form to be laid out in a certain way, different than the way my columns were laid out in the "CSI" worksheet. I didn't want to have to go back and rename all my Named Ranges in the "CSI" worksheet, so I just copied the data over into "Find" and reorganized it.

    When this data validation problem gets solved and I go back and start over from scratch, rebuilding my spreadsheet the right way, I am pretty sure I can reorganize the data in the "CSI" worksheet so that if a Data Form is based on it that it will look the way I want.

    Because I had removed all locks and protection the worksheet that you had to work with, I was able to copy the information in the "2010 Code And Description" field before I hit the close button on the Data Form. Then I was able to paste it directly into one of the cells on my "Test" worksheet.

    That was beautiful, because it prevented me from having to either remember, or write down that information and after I pasted it, and the two lookup fields to the left still worked fine. It would be a huge timesaver if I could retain that copy and paste functionality.

    I can't leave the underlying data that the Data Form is based on unlocked and unprotected though, because it could too easily get corrupted by someone inadvertently making a mistake while working with the Data Form.

    With that underlying data protected though, I am not able to select any of the information so I can copy it. Do you know of a solution to that?

    Also, if I do base my Data Form on the “CSI” worksheet, there will be a lot of extra columns in that worksheet that I don’t want to have show up on my Data Form. Is there a way to change the "Find" macro to somehow limit (or select) the range of data that the Data Form shows?

    Thanks, Spence

  14. #14
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Filter Results Shown In Data Validation List

    Try this in the sheet module for Sheets("Main")
    Please Login or Register  to view this content.

    And this in a standard module
    Please Login or Register  to view this content.

    I have made the named range "DIV_NAMES" dynamic.
    Refers to
    Please Login or Register  to view this content.
    If you add to or subtact from this range the code will detect this. Keep the list continuous, and begin all entries so,

    "Division ??"

    i.e. "Division" Space and 2 digit number

    I have deleted "DIV_ALL", I don't think it is needed, nor are Columns B & C on Sheets("Names")

    There should be no need for your VLOOKUP in Sheets("Main") F2 and I have moved the cell refs for your option buttons to D4

    To change the preferred lists just enter or delete 1 in Sheets("CSI") Column J

    Hope this helps

    [EDIT]
    Neat solution WHER
    Attached Files Attached Files
    Last edited by Marcol; 12-22-2010 at 12:17 PM.

  15. #15
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Filter Results Shown In Data Validation List

    In response to post #12, see attachment.
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Marcol, I get an error due to this piece of code when a particular CSI category does not have any items marked as Preferred.

    Please Login or Register  to view this content.
    It is trying to subtract one from zero. Do you have a quick patch you can show me to prevent errors in the unlikely case that a particular CSI category has no preferred items?

    Thanks for all your help,
    Spence

  17. #17
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Filter Results Shown In Data Validation List

    Can't remember the full code, but try
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Quote Originally Posted by Marcol View Post
    Can't remember the full code, but try
    Please Login or Register  to view this content.
    I tried something similar myself and was able to get past that line of code, but it generates an error further down in the code:

    Please Login or Register  to view this content.
    If you could take another look at this I would really appreciate it. You posted most of your code in Post #14 on page one of this thread. The spreadsheet itself with all your code in it is also attached to that post.

  19. #19
    Forum Contributor
    Join Date
    05-17-2007
    Location
    Michigan, US
    MS-Off Ver
    2007
    Posts
    111

    Re: Filter Results Shown In Data Validation List

    Marcol, after I posted my reply above I thought of something to try which seems to work. Please let me know if you see any problems with my solution as it does seem to work fine.

    Please Login or Register  to view this content.

  20. #20
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Filter Results Shown In Data Validation List

    Was the problem also raised when D2 was empty?

    I have added this Exit condition
    Please Login or Register  to view this content.

    Try this amended code to handle the situation where there are no Preferred items, (see the new If statement at the end of Select Case 1)
    Please Login or Register  to view this content.
    Last edited by Marcol; 03-15-2011 at 05:34 AM.

+ 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