+ Reply to Thread
Results 1 to 6 of 6

No Duplicates

  1. #1
    Registered User
    Join Date
    02-25-2008
    Posts
    15

    No Duplicates

    I am working with 3 worksheets in the same book. I do not want the same part number duplicated in the three worksheets. If a part number is used on sheet 1 I do not want that same part number to be used again within those three sheets.
    Please help
    Thanks

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: No Duplicates

    are you saying that you are adding to other sheets and dont want to reuse a partnumber or they already exist and you want to check?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    02-25-2008
    Posts
    15

    Re: No Duplicates

    I am using a lot of part numbers on three different sheets. The part number can only be used once on the sheets weather it be on sheet one, two or three.
    I would like a note or warning the number was already used or is being duplicated.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: No Duplicates

    OK assuming part numbers are always in col A sheets1 2 and 3
    create 3 named ranges referring to as many cells in column as you think you'll reasonable need say
    A1:A5000
    then conditional format each column A (again only as many cells as you reasonably need) with
    "formula is"
    and enter
    =COUNTIF(range,A1)+COUNTIF(range2,A1)+COUNTIF(range3,A1)>1
    pick a cell colour.
    now duplicates in any cell in col A of any sheet will change colour on entry
    see attached
    to view my named ranges click insert/name and you will see names martin1,2,3 click on any of them to see which cells they refer to.
    Attached Files Attached Files
    Last edited by martindwilson; 06-12-2009 at 09:19 PM.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: No Duplicates

    I think that same approach can be used in a Data Validation on the A columns as well, just use a Validation of Custom: Formula:

    =COUNTIF(range,A1)+COUNTIF(range2,A1)+COUNTIF(range3,A1)=0

    Then on the Error Alert tab a little message that says, "The part number you entered has been used already."

    So this would flat out stop you rather than just lighting up the cell with a color.
    _________________
    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!)

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: No Duplicates

    tried tht jb and it doesn't want to know
    but is should be =1 to work anyway
    but it wont even work with a single range name (,at least in '97)
    range martin1 = a1:a5000
    =COUNTIF(martin1,A1)=1 doesnt work
    =COUNTIF($a$1:$a$5000,A1)=1 does

+ 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