+ Reply to Thread
Results 1 to 12 of 12

Automatically fill in a dropdown selection based on a previous dropdown

  1. #1
    Registered User
    Join Date
    09-23-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    26

    Smile Automatically fill in a dropdown selection based on a previous dropdown

    Hello there,

    Thank you for spending your time reading this.

    I've been trying to solve this for a couple days but got to nowhere. So the problem is let's say I have 2 columns, one named Group and one is Response
    Group Response(Yes/No)
    A
    A
    B
    B
    C
    C

    My goal is to create a drop list with Yes/No option for the Response columns for every row, and if I choose Yes for the first row of Group A, the second row of Group A also turn YES. Also, if I choose Yes for the second row of Group A, the first row of Group will become Yes, same ideas with Group B and C, and I have more than 1k different groups. Basically, I want to have same answers (Yes or No) within the same group, and doesn't matter which one we click first for the drop down list.

    I tried to create a new sheet and used Vlookup, it worked well to return all answers as groups but it doesn't meet the requirement. They want to show the drop list on each row of the Response Column and make changes from there.

    Sorry I didn't know a better way to describe this problem. I hope to get help from you all. Thank you so much!
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    it sounds like you are after dependant data validation

    here is a very detailed resource (with pictures and videos) for things you need to know to get started with it
    https://www.contextures.com/xlDataVal02.html
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    09-23-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    26

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    Hello,

    Thank you for your quick response. However, this is not what I was looking for. Let me explain it again here.

    So the Group A,B,C,D are default values. I already created drop down list with Yes/No option for all the rows in Response Column. What I want is when I select Yes from the drop down list for first row in Group A, it will automatically make all the other drop down within Group A same values (Yes).

    So within every group, if you make one change of any random row within that group, it will give the other row in the same group same values (Yes or No).

    Please advise!

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    why does all the other rows need to be DROPDOWN?

    if you have one row to control the others wouldn't that make more sense?
    ie have B2 has yes/no and then have B3,B4,B5 = B2

  5. #5
    Registered User
    Join Date
    09-23-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    26

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    because let's say they insert another column (ID) before the Group, when they use filter and sort it, the B2 will disappear. So I am trying to set up the dropdown for every row, so it doesn't matter how the user filter, there's always options for them to choose.

    as I mentioned, I used vlookup with a backend-sheet and this works just fine, but the requirement of the task is to have dropdown for every row. Please share your thoughts. Thank you!

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    see attached code and sample file for what your asking

    i used worksheet_change event to trigger code

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

  7. #7
    Registered User
    Join Date
    09-23-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    26

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    Hello,

    You're the best. Thank you so much for helping this is exactly what I need. May I ask another question? So do I have to put these two columns next to each other in order for them to work? if I have more columns in between, with layers of different filters, what should I change in the VBA code?

    Again, thanks so much!!!!

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    Please Login or Register  to view this content.
    the offset determines how many columns away it is from the target

    ie
    if your group is in column A
    but your target is now column D
    offset(,-3)

    however if you do this then you need to change there your target should intersect and in turn which cells in the it should loop thru
    ie
    change
    B2:B to D2:D

    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-23-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    26

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    Hi,

    That works perfectly for me, thank you again so much. Let's say later I want to add 3 more columns G,H,J and for the H,J if they have same group in G, they will return Yes/No like the problem we just solve. How can you add another code for the VBA? Thanks

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    add another subset after the first lot to see where target is

    Please Login or Register  to view this content.
    made some minor changes to make it run smoother as well
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    09-23-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    26

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    Hello there,

    Thank you again for your help, I do have one last question though :D.

    It's about filtering. So let's say we still have the Group and Response Column, now I add Customer Name and Location columns to it. My goal is it doesn't matter how I filter my sheet, it will return same answer for Response column for all filtered sets and only affected those filtered cell. As of right now, since on the VBA code it only shows the connection between Group and Response so if I add more column and filter them, it won't work.

    Please advise and again thank you so much. Your answers been helping me so much! Thanks!

  12. #12
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Automatically fill in a dropdown selection based on a previous dropdown

    this is why you don't ask for bits of information at a time
    the logic of what you are requesting now is rather different to the original request

    suggest you provide a complete example file

+ 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. Multiple Dropdown selection & Column Groupings based on dropdown selection
    By rabrol in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2018, 10:23 AM
  2. Replies: 2
    Last Post: 03-27-2018, 08:32 AM
  3. Automatically Hide Rows Based On Dropdown Box Selection
    By tstram in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2014, 06:13 PM
  4. Replies: 8
    Last Post: 02-10-2013, 01:15 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. Replies: 2
    Last Post: 08-11-2011, 01:32 AM
  7. populating a dropdown based on choice from a previous dropdown
    By Conor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2006, 03:20 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