+ Reply to Thread
Results 1 to 29 of 29

Data Validation Warning Message

  1. #1
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Data Validation Warning Message

    When using Data Validation with “List” chosen as the validation criteria, is Excel able to identify when duplicate values have been selected from a range and issue a warning or information message to the user?
    I believe this may be accomplished when “Custom” is chosen as the validation criteria, however I would like to be able to have Excel issue a warning or information message when the user is restricted to a list.

    Any ideas or help would be appreciated!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data Validation Warning Message

    Check out Ron's solution here.
    You probably can't have two data validations in the same range.His solution is to remove the item from the list once it has been selected.

    http://www.excelforum.com/excel-gene...tion-list.html

  3. #3
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    Thank you Dave. I will take a look.

  4. #4
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    Dave,

    I reviewed the post you referred to and decided to give it a try. It seemed as if this would generate a solution to my problem. However, after applying the example to my requirements, I was unable to achieve a result. I've attached a sample of what I am attempting to accomplish. Perhaps I set up the Data Validation criteria incorrectly?
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Data Validation Warning Message

    It something to do with when the validation is triggered because if you click on the validation cell and hit enter it does display the message. One thing I noticed though, shouldnt your code be >1 rather than =1 as the count will always be at least 1 as the item youve just selected counts.

    *Thats not the reason for the problem though, if anything that would have triggered the message on every selection.
    If someone has helped you then please add to their Reputation

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data Validation Warning Message

    Here is a VBA approach, select the drop down and when you have a duplicate in the range, a msgbox will pop up.

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

  7. #7
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data Validation Warning Message

    While you could do that...I skip the need of an alert system by removing the option from the list after it is selected. Take a peek at this workbook on sheet1. In col A there is a formula counter that finds out if the item has been used before.

    D is a static count (Should be up to max options, I went well past your total count)
    E is going to pull over all of the unused items from the list in B (Which should be your full list) based on what A finds has not been used.
    The validation (Named Range) is E2:E22 (Or the Max set of options)

    Now when one is selected in the blue box the next time someone tries to select an option the previous will not be available, eliminating a need for an error.

    Data Validation Example_DynamicList.xlsx
    -If you think you are done, Start over - ELeGault

  8. #8
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Data Validation Warning Message

    Quote Originally Posted by ELeGault View Post
    While you could do that...I skip the need of an alert system by removing the option from the list after it is selected. Take a peek at this workbook on sheet1. In col A there is a formula counter that finds out if the item has been used before.
    Although I think thats a perfectly fine way to do it there will be scenarios where removing the item from the list is not an acceptable way. For instance, if this was a list of payments made then you'd need to allow the user the facility to record the fact this 2nd payment had been made and then highlight the error. Removing it from the list may cause users to just ignore the item and move to the next one thereby never highlighting the problem.

  9. #9
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data Validation Warning Message

    if this was a list of payments made then you'd need to allow the user the facility to record the fact this 2nd payment had been made and then highlight the error.
    I see where you are going with this, but in the scenario presented by the OP the alert/warning would restrict the user from being allowed to use this. If it was just to illustrate that this is a duplicate then we could apply some CF to bring that to notice or use the data validation to alert that this is a duplicate value as an FYI. Otherwise you can add further logic to the count statement that would say when and if something occurs to keep it in the count. Really that count list can become quite complex and is in many of the actual applications I use it for - just an option and your point is well noted. I do think for the scenario (IF I read correctly) then this should suffice in the OP's needs. But it is late so lol

    Cheers

  10. #10
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Data Validation Warning Message

    I agree totally, the solution youve provided is ideal for this post, I was highlighting the fact that anyone pulling this thread up in future as a possible solution should check their requirements before implementing any of the solutions raised (that goes to be honest for every thread in here, solutions found here (or anywhere else on the net) are not always guaranteed to solve someone elses problem).

    It nice and early here, already 2.5 hours into the working day!

  11. #11
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data Validation Warning Message

    Agreed - Yea Im about to sleep for 5 hours then off to work lol I am a bit of an insomniac though so... Don't really feel tired, just know I need to sleep

  12. #12
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    Thanks to all for your replies, examples and insight. I will follow up on the examples provided and report back on which example works best! Stay tuned!

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

    Re: Data Validation Warning Message

    This use of Data Validation lists will not allow duplicate entries because as an item is chosen, it is removed from the available items. The Data Validation lists are set up on Sheet1.
    Attached Files Attached Files
    Last edited by newdoverman; 12-17-2014 at 11:19 AM.
    <---------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

  14. #14
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data Validation Warning Message

    Didn't like my post version of that eh NDM

  15. #15
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    newdoverman, thanks for your suggestion and thanks as well to EleGault and davesexcel for your suggestions. I decided to try newdoverman’s suggestion first as it seemed the most appropriate for my needs. Although his suggestion works perfectly in the sample I downloaded, when I attempt to recreate it, everything appears to work as designed, however, once a selection in the data validation list is made, the selection remains visible in the list and if I understand the example properly, that selection should be removed from the remaining available selections.

    When I downloaded newdovernan’s example it worked in that once a selection was made from the data validation list, that selection no longer appeared in the list of available choices which is the solution I am looking for.

    I’ve uploaded a sample spreadsheet that demonstrates where I attempted to replicate the suggested layout and formula. Perhaps I made an error when I recreated the example and one can take a look to advise as to why my recreation was unsuccessful.
    I will await a reply to this post before trying EleGault’s or davesexcel example. Thanks again everyone.
    Attached Files Attached Files

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

    Re: Data Validation Warning Message

    @EleGault

    No problem at all with your post In fact I may not have seen it because for some reason at certain times of the day, posts seem to be held somewhere for times ranging from a few minutes to several hours I think it has to do with the Internet Gateway into and out of Canada. I have had this problem with other sites.

    We had basically the same idea. I simply used a slightly different method and added a dynamic quality to the Data Validation drop down list....as items are used, the list actually gets shorter so there is no white space in the listing. Davesexcel pointed to another solution that was quite similar but wouldn't handle text strings for data mainly due to the use of the COUNT function instead of COUNTA.

    Not being sure of the ability of the OP, a variety of possibilities doing pretty much the same thing will show that there is variety in what will work.

  17. #17
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data Validation Warning Message

    I'm attaching the workbook again, I didn't notice I deleted the Data Validation List.

    The code is using countif , (not count or counta) and does appear to work for both text and numeric values.
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Data Validation Warning Message

    NDM - No worries, I didn't dive into yours too much just noticed it a little later and made me smile - Actually I rather like that we are on the same page to eliminate the error process and prevent it all together.

    Have not looked but I am guessing that Dave adjusted it accordingly - Cheers

  19. #19
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data Validation Warning Message

    I didn't have to change anything

  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: Data Validation Warning Message

    To me, eliminate errors where possible, then you don't have to deal further with them.

    Dave's solution uses a macro to flash an error if a duplicate entry is attempted. The duplicate value is still in the DV list. All this just shows that there are many ways to "slay the cat" in Excel. The only thing that matters is that the solution suits the person who is going to use it.

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

    Re: Data Validation Warning Message

    @davesexcel

    I see that your bird has its Christmas toque on

  22. #22
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data Validation Warning Message

    It was just a bird, but a few years ago teylyn added a toque to it. Haven't had the heart to remove it since.

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

    Re: Data Validation Warning Message

    Sorry for the delay. I received notification of your message 21 hours after you posted it.

    The problem that you encountered was due to the definition of the TEAMS name in the Name Manager.

    This should work.
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    Thank you NDM for the reply. No worries about the delay. So for my edification, application of "=OFFSET" command and remainder of the formula in the Name Manager "Refers to" section is what causes the data validation list to revise the available remaining list selections? Very cool! Thanks so much!

  25. #25
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    Okay, one more thing for now, in the "live" workbook I'm developing, for aesthetic purposes, I actually have two areas where the user may choose from the "TEAMS" list in order to make team assignments to each respective player. I attempted to modify the formula in cell L1 of the attached sample as follows so that the formula would consider multiple "list" ranges: =IF(COUNTIF($I$5:$I$28,K5)=0,MAX(L$4:L4)+1,IF(COUNTIF($Q$5:$Q$28,K5)=0,MAX(L$4:L4)+1,"")). What happens is that my attempt fails and the pick list doesn't exclude each team assignment (e.g. 1-A; 3-B, etc.) as it's chosen from the TEAMS list. Is there a manner in which the formulas may be modified so as to allow your solution to cause the COUNTIF function to consider multiple validation lists? I've attached the file Data Validcation Example - Multiple Ranges" for you to see my work.

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

    Re: Data Validation Warning Message

    Ok, here is how the formula should have been written so that when a choice is made from either column I or column Q the item will not be available again in either listing.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The enclosed is the result:

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

    Re: Data Validation Warning Message

    Thank you for the feedback and the rep.

  28. #28
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    Thanks NDM. I will give this a try.

  29. #29
    Registered User
    Join Date
    09-09-2008
    Location
    Troy, MI
    MS-Off Ver
    2010
    Posts
    95

    Re: Data Validation Warning Message

    Update to the formula worked perfectly. Thanks to all who contributed.

+ 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. Show same surname's first names after data validation warning message
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2013, 12:04 PM
  2. Warning message. And changing data without close message.
    By pinguino in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2013, 03:01 PM
  3. need of pop up message dynamically using data validation input message method
    By vba_life in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2010, 09:03 AM
  4. Message Warning Box/Data Validation
    By AdrianIT in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-10-2007, 10:45 AM
  5. run macro after yes to data validation warning message
    By al007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-17-2005, 12:30 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