+ Reply to Thread
Results 1 to 25 of 25

Dynamic drop list which removes options that are already chosen

  1. #1
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Dynamic drop list which removes options that are already chosen

    Hello

    Im trying to make a time Schedule for workers
    each hour has its own row and each column is represents a room

    i would like to make it so that in each hour there cannot be the same name chosen twice

    i have sucecesfuly made it on a single row by using another table (see MATH sheet) But i feel like that solution is not very elegant and i will have hard times copying it to every single hour, since i would have to copy the whole table every time.

    Is there a better solution that i could easier copy to each hour?

    EXTRA:
    would it be possible to add another list for choosing the type of work (next to the names) where you could define what you could and couldnt do in which room and it would only offer you those options?

    or add another condition that would remove certain options in certain rooms

    Thanks for help
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Dynamic drop list which removes options that are already chosen

    Try this on the rozvrh tab in the VBA editor.


    Please Login or Register  to view this content.
    Martin

  3. #3
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    Tried it out, it doesnt do anything, what is it supposed to do?
    i tried checking the code for , and ;

  4. #4
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Dynamic drop list which removes options that are already chosen

    Hi,

    Put the mrice code - without having to change anything in it - in the spreadsheet module, and then choose from one DV and you will see that you've chosen in a DV does not appear in another.


    i tried checking the code for , and ;
    You can use that ONLY in formulas NOT in VBA code.

  5. #5
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Dynamic drop list which removes options that are already chosen


  6. #6
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    I believe with "choose one DV" you mean the yellow cells, if its so, then it doesnt work, i could have most of the name twice there.
    It also doesnt seem to do anything else, i cant figure it out, not even in the file mrice has posted

    the code seems to work with color and im not sure why, its not doing what i needed it to do, but maybe im not meeting some conditions?


    anyway im interested in this solution but i found a workaround meanwhile that checks for the same word and hits me with an error message if there are meanwhile, a dissapearing droplist would be better though

  7. #7
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Dynamic drop list which removes options that are already chosen

    The workbook supplied should work like this.

    Select a name form the list of 12 in the first column.

    Now move to the second column and you should see that the name selected in the first column is not in the list of 11 names. Pick one of these.

    Now move to the third column and you should only have a list of 10 options.

    I used the yellow colour as a quick way of identifying which cells contained the drop down lists. As I don't know the final structure of your workbook, I'm assuming that you would take the approach that I have suggested and adapt it as appropriate.

    I hope that this helps

  8. #8
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    it will look like if you took every thick bordered cell and copied it to the whole Schedule - the first row will be everywhere so to say

    what you desribed is what i want it to do, but it doesnt work, i could put almost any name twice there before it dissapeared

    it seems to only delete the name from the list of the first right cell
    example
    i entered NAME1 in the room1 cell, the room2 cell doesnt offer name1 but all of the others do, after that i wrote name 1 in the room4 cell, room5 doesnt offer it and the rest does still, it only removes it from the second one, i would need it to remove options from the entire row

  9. #9
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Dynamic drop list which removes options that are already chosen

    Can you try this please

    Please Login or Register  to view this content.
    My original solution assumed that you would fill in the boxes in each row from left to right and therefore only set the validation for the next column on the right. The above variation does not make this assumption.

  10. #10
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    Oh i see, well no, only the yellow parts will be filled - not every cell but every third one

    Tested it out, it seems to work perfectly in the yellow part, if there is no background color it doesnt work but if there is one or even two different it seems to work, though once i managed to get one name twice and that kinda worries me.

    My problem is now, could you somehow do it without being based on colors? My colors keep changing all the time, they change together with the names and it crashes when i choose a name and it tries to change the color XD

    i wouldnt mind giving it a certain range as long as i can give it each cell and itll only count rows (you saw what it looks like, i only need rows to delete each other and not every cell)
    Sorry for my noobiness and bad explaining

  11. #11
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Dynamic drop list which removes options that are already chosen

    OK - try this. It works by assuming that the cells are in a regular pattern.

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    Thanks for the fast reply

    This doesnt seem to work at all though, ill attach what i tested it with, and the other attachement is what i plan on using it with later if we get it working, just so you see what i have to change later or what the problems are
    Attached Files Attached Files

  13. #13
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Dynamic drop list which removes options that are already chosen

    Mistake in my code. Please try this.
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    Awesome! seems to work the way it should, youre genius!

    It even works with new cells DV i added after

    Now tell me, and you had that question coming, what do i need to adjust when using this formula for another file? from what i can tell the "seznamy" name will probably have to be changed.. and there, is that row count? like every X row? a colorful guide would be awesome, thanks!

    Doesnt let me to give you anymore reputation, sorry

  15. #15
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    wait i was happy too early, changing the names or deleting them or anything results in a complete mess!

    no idea why - the list is linked to them, even though i deleted names 7 - 12, instead of offering only names 1-7 it offers me 7-12 which are deleted o.O
    another cell only offers me name 2 while all around are empty
    and other funny random stuff

    one row works fine, but doesnt delete the names, but at least it works

    once i did somethign and it errored and offered "debug" so i clicked it and this row got yellow

    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
    xlBetween, Formula1:=NameString

  16. #16
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Dynamic drop list which removes options that are already chosen

    As you worked out, the seznamy sheet is used to provide the list of names. This will need adjusting if the names are elsewhere.

    The cells are chosen by using the Mod function for both row and column. As the pattern repeats every 4th row, I've taken the row that the cell is in, subtracted 3 to get a multiple of 4 and then applied the Mod function to get a zero which is what I test for. I could equally well have added one to the row number or just looked for a mod of 3.

    Every time a cell is populated, the process runs to get a list of all the names in the row and only includes the names from the seznamy sheet where these are not already used. This is then used to set the validation for all the cells in the row.

    I hope that this helps.

  17. #17
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    Yes that helped me understand it a lot! But i dont see where the bugs come from when i change the names, it also looks quite difficult to adapt, i dont think sheet name would be enough, i would also have to change the cells adresses in the sheet and the counting as well... im scared to get lost in it, and scared that the bugs will still be there

  18. #18
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Dynamic drop list which removes options that are already chosen

    Here is a solution without VBA
    Insert a blank row at the top of worksheet MATH.
    Enter in B2 and fill down. This covers to row 111 on the rozvrh worksheet.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Enter in C2 and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I have filled in several drop-downs on the rozvrh worksheet as a test of the correct operation of the formulae.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  19. #19
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    Your solution deletes names from the entire document and not each row good try though, if one has just one place to use this, it is definately a better way than the row count i found first

  20. #20
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Dynamic drop list which removes options that are already chosen

    Ok, here is a formula based solution that covers all 27 hours separately. The defined names have been altered to show the hour that the name belongs to.

  21. #21
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    Thanks, i appreciate your time and it works, cant use it afterall because id need it in the same sheet and it takes too much space, but its great to know it can be done properly

  22. #22
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Dynamic drop list which removes options that are already chosen

    Here is the same workbook with all on one worksheet

  23. #23
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    wtf, where did you hide all the stuff?! XD

  24. #24
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Dynamic drop list which removes options that are already chosen

    Take a look at the column letters starting at A. There is a big jump in the lettering. That is where there are hidden columns. They work just as well only you can't see them.
    Hidden columns.JPG

  25. #25
    Registered User
    Join Date
    03-26-2016
    Location
    cz
    MS-Off Ver
    07/10
    Posts
    73

    Re: Dynamic drop list which removes options that are already chosen

    ohhhh sneaky

+ 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. [SOLVED] Create drop down list from chosen value
    By RinorM in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2014, 11:28 AM
  2. [SOLVED] Need formula to list options chosen
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 40
    Last Post: 07-22-2014, 05:52 PM
  3. Display different list in a list box when specific drop down chosen
    By lwwc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2013, 05:27 AM
  4. [SOLVED] Suppress drop-down list dependent on value chosen in another drop-down list
    By ptmald in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2013, 07:17 PM
  5. (SOLVED) Drop down list removes used cells
    By SubwAy in forum Excel General
    Replies: 5
    Last Post: 10-22-2011, 01:56 PM
  6. My Excel drop-down list eliminates from list options chosen. Help
    By Sybil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2006, 05:25 PM
  7. Replies: 5
    Last Post: 11-09-2005, 06:40 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