+ Reply to Thread
Results 1 to 4 of 4

How to get data validation to work when a duplicate value is pasted into a column

Hybrid View

  1. #1
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    How to get data validation to work when a duplicate value is pasted into a column

    I have to enter patient's SSN's into my database. The fastest and most error free way to do this is simply copy the SSN from the electronic chart and paste into the appropriate cell in the database. I don't want duplicates. So, I need the database to alert me when I paste in a duplicate SSN.

    I know you can set data validation to do prohibit duplicates by using a formula. In the attached spreadsheet the SSN is in column B, so:
    =countif(B:B,B1)=1
    prevents duplicate SSN's from being entered.

    However, it only works when a duplicate value is typed into the cell. It doesn't work when a value is pasted into a cell. Also, I know you can use the "validation" option in "paste special", but that's another step to remember everytime I cut and paste. And sometimes I forget.

    Is there a way to get data validation to work when a duplicate value is pasted in to a cell?
    Attached Files Attached Files
    Last edited by Research RN; 02-11-2009 at 10:48 AM.

  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: How to get data validation to work when a duplicate value is pasted into a column

    as far as i know data validation is rendered ineffective on paste. perhaps the way to go is to use vba to prevent paste into cell.

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

    Re: How to get data validation to work when a duplicate value is pasted into a column

    The simplest of all answers is to do your pasting within the cell rather than ONTO the cell.

    In the cell that has the SSN you're going to copy, press F2, then Shift-HOME to highlight the SSN, then CTRL-C to copy the SSN directly. You're not copying the whole cell including it's formats and such, you're copying the data IN the cell into you're computer's memory.

    Now select your target cell, press F2 again, then CTRL-V directly into the cell rather than onto it.

    This will not break any validation or conditional formatting, and is something you could get used to doing.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    Re: How to get data validation to work when a duplicate value is pasted into a column

    Quote Originally Posted by JBeaucaire View Post
    The simplest of all answers is to do your pasting within the cell rather than ONTO the cell.

    In the cell that has the SSN you're going to copy, press F2, then Shift-HOME to highlight the SSN, then CTRL-C to copy the SSN directly. You're not copying the whole cell including it's formats and such, you're copying the data IN the cell into you're computer's memory.

    Now select your target cell, press F2 again, then CTRL-V directly into the cell rather than onto it.

    This will not break any validation or conditional formatting, and is something you could get used to doing.
    Thanks, I'll try that.

+ 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