+ Reply to Thread
Results 1 to 4 of 4

Thread: Multiple Validations or VBA help - Prevent Duplicates

  1. #1
    Registered User
    Join Date
    09-21-2011
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Multiple Validations or VBA help - Prevent Duplicates

    Hi All,



    I am making an excel code that verifies there are no duplicate barcodes(entries).



    I just want the entries to go down the rows of column A and a message to pop up if there is a repeat. I currently have a file that checks every new entry with entries above it using data validation and the following function:



    =ISNA(VLOOKUP(A10,A$1:A9,1,FALSE))



    I want to also check the rows below in case someone accidently skips some rows then another person goes back and fills in the skipped rows.



    I have tried a few methods to do this but each has a different problem.



    1-I included that the array be in two blocks:



    =ISNA(VLOOKUP(A10,(A$1:A9,A11:A$50000),1,FALSE))



    This yields an error message and array problem.



    2-I have also tried making the equivelent row in column B check for the repeat in column A by putting the formula =ISNA(VLOOKUP(A10,A11:A$50000,1,FALSE)) directly into validation for column B. The problem with this is that there is no message pop-up, I assume because it doesnt deal with the cell the validation is in.



    3- I have made the validation formula in terms of column B, and I set column B to equal its equivalent row in column A. As Column A is filled out column B matches it, then the validation should check it for column B.



    =ISNA(VLOOKUP(B10,B11:B$50000,1,FALSE))



    The problem with this is that my error code won't appear unless I go into column B, activate the cell, then return it.



    I would like this procedure to work with only having to input values into column A and an message window popping up if there is a duplicate.





    I would consider using Micro's but am not that familiar with it and would need some guidance. ANY HELP is HIGHLY APPRECIATED!!



    Thanks so much guys!!

    -Scott
    Last edited by scott0102; 09-27-2011 at 07:52 PM.

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Multiple Validations or VBA help - Prevent Duplicates

    I would think a single formula to check the entire column for duplicates.

    1) Highlight column A
    2) Apply these DV settings:

    Allow: Custom
    Source: =COUNTIF(A:A,A1)<2


    With that, new entries are allowed anywhere in column B, duplicates are not, whether above or below.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-21-2011
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Multiple Validations or VBA help - Prevent Duplicates

    That worked perfectly,
    Thanks so much for the help!

  4. #4
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Multiple Validations or VBA help - Prevent Duplicates

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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.2.0