+ Reply to Thread
Results 1 to 11 of 11

Preventing column duplicates unless specific condition

  1. #1
    Registered User
    Join Date
    03-29-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    13

    Preventing column duplicates unless specific condition

    Hello,
    I have been trying for some time to figure this out, but having difficulties. I want to prevent duplicates in column B unless the load does not deliver to SiteC (column D). If the load is moving from SiteA to SiteC, no duplicates allowed, but if delivering to SiteB, then there will be another instance where the load will have to move from SiteB to SiteC, therefore 1 duplicate is allowed. Any ideas how to make this work? Not sure if I have to use VBA to code it or if there is a formula we can use in data validation. Any help would be greatly appreciated.

    Thanks,

    Eric
    Attached Files Attached Files
    Last edited by ericequip; 05-27-2011 at 08:23 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Preventing column duplicates unless specific condition

    Like this?
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-29-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Preventing column duplicates unless specific condition

    When I enter those serial numbers in B8 & B9, those are the only circumstance that I want to allow a duplicate serial number. When I try to enter, it tells me that there is a duplicate entry. That is the only condition where I will allow a duplicate. I don't want to allow duplicates when the origin is siteA and destination is siteC. I previously used "=COUNTIF($B$5:$B$12,B5)=1, but only works for single duplicates.

  4. #4
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Preventing column duplicates unless specific condition

    Ok, let's try again.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-29-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Preventing column duplicates unless specific condition

    That works! Thank you. Is there a way to allow for only 2 duplicates, not more. As to load is delivered to SiteC, no more instances of the same serial number would be allowed.

  6. #6
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Preventing column duplicates unless specific condition

    Try replacing the "<=1" at the end of the validation formula with "<=2" ?

  7. #7
    Registered User
    Join Date
    03-29-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Preventing column duplicates unless specific condition

    That doesn't work either. Anything other than siteA to siteC, many duplicates are allowed. I modified the code to try different variations: =IF(($B$5:$B$12=B5),1,IF(AND(C5="SiteA",D5="SiteC"),1))<=1, and still the same. For some reason, just can't limit the duplicate to 2 only.

  8. #8
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Preventing column duplicates unless specific condition

    Not giving up yet.
    Attached Files Attached Files
    Last edited by WHER; 05-27-2011 at 04:33 AM.

  9. #9
    Registered User
    Join Date
    03-29-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Preventing column duplicates unless specific condition

    Still not working, but I see what you are trying to do. I am also trying to play with your formulas, working at it as well.

  10. #10
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Preventing column duplicates unless specific condition

    Modified the attachment in post #8

  11. #11
    Registered User
    Join Date
    03-29-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Preventing column duplicates unless specific condition

    Thank You!!!! That worked perfectly. Even prevents the use of the same serial number even if the site locations haven't been entered. Thank you very much for all 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