+ Reply to Thread
Results 1 to 15 of 15

Data Validation List based on Criteria

  1. #1
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Data Validation List based on Criteria

    Evening,

    I'm becoming stuck on trying to work out how to create data validation lists.

    What I'm trying to achieve is a data validation based on criteria.

    So there will be 4 possibly 5 columns and a user will select from the first data list in column 1, which is Director.
    The next column, which is General Manager the user will then be able to pick from a data list that will have the direct reports to the Director selected in the previous column.
    The next column, which is Business Manager the user will then be able to pick from a data list that will have the direct reports to the General Manager in the previous column.
    The next column, which is Team Leader the user will then be able to pick from a data list that will have the direct reports to the Business Manager in the previous column.

    I have a massive data set to work with hundreds of names, is this something that would be easily achievable in excel or should I look at doing it another way?


    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: Data Validation List based on Criteria

    Look at these two links for possible methods

    https://www.contextures.com/exceluse...omboboxes.html

    https://www.thesmallman.com/blog/202...-3-and-4-layer
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Re: Data Validation List based on Criteria

    Thanks for these links.

    VBA isn't something I'm familiar with sadly - even though the second link would work a treat I'm not sure I understand how it's all working or if it was to break how I could ever fix it 🤣

  4. #4
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,361

    Re: Data Validation List based on Criteria

    Attached is another method using the FILTER function to look up the latest 'DIRECTOR' to be added to the list in column A. The downside to this method is that the validation lists will always be set up for the latest entry in column A so if you wanted to amend the dropdown of the director above the one you just selected then the lists would be wrong.

    On the 'Staff List' sheet:
    H1: =INDEX(A32:A48,COUNTA(A32:A100))
    I2: =FILTER(B3:B27,A3:A27=H1)
    J2: =FILTER(C3:C27,A3:A27=H1)
    K2: =FILTER(D3:D27,A3:A27=H1)

    Director valdation formula: =$A$3:$A$27
    General Manager valdation formula: =INDIRECT("I2:I" & COUNTA(I:I))
    Business Manager valdation formula: =INDIRECT("J2:J" & COUNTA(J:J))
    Team Leader valdation formula: =INDIRECT("K2:K" & COUNTA(K:K))

    File attached for reference.
    Attached Files Attached Files
    If things don't change they stay the same

  5. #5
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Cool Data Validation List based on Criteria

    Hi,

    I was sent a great link as a solution to my cascading list query that I had and looking at the information and watching the YT video it's exactly what I need. I don't want the combo boxes but more the data validation input part.

    The link is https://www.thesmallman.com/blog/202...-3-and-4-layer

    I'm struggling with the actual VBA code as it's not an area I'm familiar with at all.

    The example on the link is based on 3 columns of data and a 4th column of numbers is added without changing anything from a VBA point.

    If I had 6 columns of data is there something in the code that I need to change to expand the range?

    I've attached a copy of the code from the attached link.

    Thanks!
    Attached Files Attached Files

  6. #6
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Data Validation List based on Criteria

    Threads merged and moved to the VBA section.
    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.

  7. #7
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Re: Data Validation List based on Criteria

    Quote Originally Posted by AliGW View Post
    Threads merged and moved to the VBA section.
    Thank you for doing this. I thought it was a separate ask so I appreciate that you have merged the posts together.

    Many thanks!

  8. #8
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Re: Data Validation List based on Criteria

    Quote Originally Posted by alansidman View Post
    Thanks for sharing these links - bottom one is exactly what I'm looking for. Just need the knowledge to make it work

  9. #9
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Data Validation List based on Criteria

    Here's another option:
    This is an example of 3 dependent data validation, with VBA. You can easily set up more than 3 dependent data validations as needed.
    Notes:
    1. You only need 1 table as data validation source, 1 helper column, 1 named range & 1 simple formula in data validation (ie =xName).
    2. The columns where data validation reside may or may not be contiguous.
    3. The list in the table may have duplicate, empty & unsorted, but the code will make the list in data validation unique, sorted & non-empty. The list is also dynamic, you can add more data as needed.
    4. In the range with data validation, changing or deleting cell contents will delete cells in the next column with data validation.
    5. But one caveat of using macro is when macro changes/writes something on sheet it will delete Undo Stack, so at that time you can't use UNDO. In this case it happens every time you put the cursor in a cell with data validation.

    The workbook:

  10. #10
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Re: Data Validation List based on Criteria

    Quote Originally Posted by Akuini View Post
    Here's another option:
    This is an example of 3 dependent data validation, with VBA. You can easily set up more than 3 dependent data validations as needed.
    Notes:
    1. You only need 1 table as data validation source, 1 helper column, 1 named range & 1 simple formula in data validation (ie =xName).
    2. The columns where data validation reside may or may not be contiguous.
    3. The list in the table may have duplicate, empty & unsorted, but the code will make the list in data validation unique, sorted & non-empty. The list is also dynamic, you can add more data as needed.
    4. In the range with data validation, changing or deleting cell contents will delete cells in the next column with data validation.
    5. But one caveat of using macro is when macro changes/writes something on sheet it will delete Undo Stack, so at that time you can't use UNDO. In this case it happens every time you put the cursor in a cell with data validation.

    The workbook:
    This looks great - I will have a look more into this solution. Thank you for this, very useful indeed!

  11. #11
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Re: Data Validation List based on Criteria

    Quote Originally Posted by CheeseSandwich View Post
    Attached is another method using the FILTER function to look up the latest 'DIRECTOR' to be added to the list in column A. The downside to this method is that the validation lists will always be set up for the latest entry in column A so if you wanted to amend the dropdown of the director above the one you just selected then the lists would be wrong.

    On the 'Staff List' sheet:
    H1: =INDEX(A32:A48,COUNTA(A32:A100))
    I2: =FILTER(B3:B27,A3:A27=H1)
    J2: =FILTER(C3:C27,A3:A27=H1)
    K2: =FILTER(D3:D27,A3:A27=H1)

    Director valdation formula: =$A$3:$A$27
    General Manager valdation formula: =INDIRECT("I2:I" & COUNTA(I:I))
    Business Manager valdation formula: =INDIRECT("J2:J" & COUNTA(J:J))
    Team Leader valdation formula: =INDIRECT("K2:K" & COUNTA(K:K))

    File attached for reference.
    Thanks for this suggestion. Another possible solution that I will look into and see if I can use this. Thanks again!

  12. #12
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Re: Data Validation List based on Criteria

    Thank you all for the help - managed to sort something out.

    I'll close this thread.

  13. #13
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Data Validation List based on Criteria

    For the wider benefit, please SHARE your solution! This is a community.

  14. #14
    Registered User
    Join Date
    05-14-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    31

    Re: Data Validation List based on Criteria

    Quote Originally Posted by Akuini View Post
    Here's another option:
    This is an example of 3 dependent data validation, with VBA. You can easily set up more than 3 dependent data validations as needed.
    Notes:
    1. You only need 1 table as data validation source, 1 helper column, 1 named range & 1 simple formula in data validation (ie =xName).
    2. The columns where data validation reside may or may not be contiguous.
    3. The list in the table may have duplicate, empty & unsorted, but the code will make the list in data validation unique, sorted & non-empty. The list is also dynamic, you can add more data as needed.
    4. In the range with data validation, changing or deleting cell contents will delete cells in the next column with data validation.
    5. But one caveat of using macro is when macro changes/writes something on sheet it will delete Undo Stack, so at that time you can't use UNDO. In this case it happens every time you put the cursor in a cell with data validation.

    The workbook:
    Hi Akuini- Just wanted to come back and feedback that following further changes to the excel project I was working on which needed data validation lists this solution as posted by you worked perfectly. Solution was very easy to follow and also easy to incorporate into my build. The excel project has now successfully completed. Thanks again!

  15. #15
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Data Validation List based on Criteria

    Quote Originally Posted by Miggy2021 View Post
    Hi Akuini- Just wanted to come back and feedback that following further changes to the excel project I was working on which needed data validation lists this solution as posted by you worked perfectly. Solution was very easy to follow and also easy to incorporate into my build. The excel project has now successfully completed. Thanks again!
    You're welcome, glad to help & thanks for the feedback.

+ 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. Data Validation Dependent List based on Criteria
    By spam3570 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2019, 06:30 PM
  2. Restrict data validation list based on criteria from multiple tables
    By jaryszek in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-25-2018, 06:30 AM
  3. Data validation filtered list based on a criteria
    By fredotom in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-24-2015, 11:01 AM
  4. Data Validation List based on criteria
    By dluhut in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-27-2014, 05:28 PM
  5. [SOLVED] Create Dynamic Data Validation List based upon Criteria
    By stubbsj in forum Excel General
    Replies: 6
    Last Post: 06-04-2012, 08:33 AM
  6. Replies: 3
    Last Post: 08-21-2011, 08:22 PM
  7. data validation list should have opt. to select based on criteria
    By be in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-15-2005, 09:05 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