+ Reply to Thread
Results 1 to 9 of 9

Validating Data To Be Unique In A Range

  1. #1
    James Dobson
    Guest

    Microsoft Date & Time Picker Control 6.0 (SP4)

    For some reason when I open the excel file that has a DT Picker box in it, the box is not the formatted shape and has a red x behind it. However, if I open another workbook and go back to the initial sheet it is fine. I need the DT picker for presentation purposes and it is a bit ackward having to open a new sheet and delete it just so the DT Picker box goes back to normal. Any ideas..?

  2. #2
    James Dobson
    Guest

    Microsoft Date & Time Picker Control 6.0 (SP4)

    For some reason when I open the excel file that has a DT Picker box in it, the box is not the formatted shape and has a red x behind it. However, if I open another workbook and go back to the initial sheet it is fine. I need the DT picker for presentation purposes and it is a bit ackward having to open a new sheet and delete it just so the DT Picker box goes back to normal. Any ideas..?

  3. #3
    Forum Contributor
    Join Date
    12-07-2004
    Posts
    596

    Validating Data To Be Unique In A Range

    Problem:

    Validiating the values entered in column A, so that a value could not be entered more than once.

    Solution:

    Select column A-->Data-->Validation-->choose Custom-->Enter this formula:
    =COUNTIF($A:$A,$A1)
    Thus, when trying to enter \"\"1\"\" in cell A10, an error message will pop out,
    and will prevent the user from entering any of the values already stored in column A.

  4. #4
    Forum Contributor
    Join Date
    08-08-2005
    Location
    Kansas, USA
    MS-Off Ver
    2016
    Posts
    293
    Neat trick. Is there a way to customize the error message?

    --GJC

  5. #5
    Registered User
    Join Date
    06-21-2004
    Posts
    3

    Not quite right?

    A solution is given as
    Select column A-->Data-->Validation-->choose Custom-->Enter this formula:
    =COUNTIF($A:$A,$A1)
    The $A1 should not be absolute? And the formula doesn't seem to work

    The following works:
    =COUNTIF(A:A,A1)=1

    Regards
    Brian

  6. #6
    Registered User
    Join Date
    06-21-2004
    Posts
    3

    Can Customize Error message with Worksheet event

    I don't believe that Data Validation allows you to customize your error messages dynamically. However, here is one workaround: Copy the code below into the code for your worksheet (Alt F11, and Double Click on the sheet name in the Project explorer on the left, and paste into the code area on the right)
    Please Login or Register  to view this content.
    This also allows you to modify what you have already entered and tells you in which cell the duplicate entry exists. The routine will loop correctly if you continue to enter subsequent duplicate values.
    You can develop elaborate custom messages.
    Regards
    Brian

  7. #7
    Registered User
    Join Date
    08-22-2005
    Posts
    1

    Red face Customizing your Error Message

    This is a fantastic tip!

    Brian, I like how your code tells the user where the original entry is located.

    GJC, for a simple custom message, this works great:
    In the Data Validation dialog box, go to the Error Alert tab to customize your error message. You can also customize the Input Message
    on its tab.

    Hope this helps!
    ~SharonFinLV

  8. #8
    Registered User
    Join Date
    04-12-2007
    Posts
    1

    Across worksheets in same workbook?

    Is there a way to apply this validation across all the worksheets in the workbook? That is for this example can you check all values in the A column in every sheet in the workbook for uniqueness when entering a value?

    Thanks,

    Paul

  9. #9
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Copy / PasteSpecial Validation

+ 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