+ Reply to Thread
Results 1 to 6 of 6

Data Validation

  1. #1
    Forum Contributor
    Join Date
    01-14-2010
    Location
    England
    MS-Off Ver
    2013
    Posts
    110

    Data Validation

    Hi,

    Can someone please help with some custom Data Validation.

    I need to enter a formula that only allows the following?
    • Only allow entries of 6 digits in length
    • Do not allow duplicates in that column

    Can anyone help with this?

    Regards

  2. #2
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: Data Validation

    Assume you want the validation in Column A
    then select range A2: to down and apply the custom validation

    =AND(LEN(A2)=6,ISNA(VLOOKUP(A2,$A$1:A1,1,0)))

  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Data Validation

    Hello,

    Assume decimals also not allowed. try this;

    =AND(INT(A1+0)=A1+0,LEN(A1)=6,COUNTIF(A$1:A1,A1)<=1)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Forum Contributor
    Join Date
    01-14-2010
    Location
    England
    MS-Off Ver
    2013
    Posts
    110

    Re: Data Validation

    Hi,

    I have tried both of these and it still allows me to insert less/more than 6 digits and allows duplicates?

    Does it make a difference that my numbers are stored as text? - sorry for not mentioning if it does (i have them stored as text due to the number 0 at the beginning, without it stored as text it removes the 0's)

    Regards,

  5. #5
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: Data Validation

    It should work, see attached workbook
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-14-2010
    Location
    England
    MS-Off Ver
    2013
    Posts
    110

    Re: Data Validation

    Sorry my bad

    It does work, i forgot to change the cell reference.

    Thank you so much for your help

+ 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