+ Reply to Thread
Results 1 to 3 of 3

Prevent a duplicate value between 2 fields

  1. #1
    Registered User
    Join Date
    08-23-2006
    Location
    Darlington, England
    MS-Off Ver
    Microsoft 365
    Posts
    33

    Prevent a duplicate value between 2 fields

    I have 2 fields and I don't want to allow the same value in either field. For example if the number 1 exists in 'Field A' I don't want to allow number 1 to be entered in 'Field B'. I've spent a considerable amount of time trying to find a solution for this but I'm struggling to work it out. I've worked out how to set up a composite index to prevent a pair of fields from matching but this not what I require.

    Does anyone know how to apply this?

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Prevent a duplicate value between 2 fields

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.

    Incidentally would you add your location to your profile please. It often helps when regional settings or date formats need to be considered.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    09-16-2017
    Location
    Agra
    MS-Off Ver
    2013
    Posts
    72

    Re: Prevent a duplicate value between 2 fields

    Quote Originally Posted by anthgav View Post
    I have 2 fields and I don't want to allow the same value in either field. For example if the number 1 exists in 'Field A' I don't want to allow number 1 to be entered in 'Field B'. I've spent a considerable amount of time trying to find a solution for this but I'm struggling to work it out. I've worked out how to set up a composite index to prevent a pair of fields from matching but this not what I require.

    Does anyone know how to apply this?
    Hi Anthgav,

    I tried and it works with below way. Feel free to share further if you need anything more. It goes like this

    Lets say your first value is in Cell "B2" and second Value is in "B3"

    Step 1 Select Cell B3
    Step 2 Goto Data Tab>Data Validation ( Under Data Tools ) > data validation > Custom.
    Under this Put this FormulA = =B2<>B3
    Step 3 . Now select Cell b2
    Step 4 Goto Data Tab>Data Validation ( Under Data Tools ) > data validation > Custom.
    Under this Put this FormulA = =B2<>B3

    Now for both cells the validation logic is in place. Try and it will post you an error.

    Hope this helps.

    regards
    RK

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to prevent duplicate entry
    By syngenta in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-02-2016, 08:01 AM
  2. [SOLVED] Prevent duplicate entries
    By Blokeman in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-06-2015, 07:24 PM
  3. Prevent duplicate entry
    By treyes55 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-04-2014, 01:31 PM
  4. [SOLVED] Prevent clicking the submit button until all fields are filled out
    By rbpd5015 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2014, 02:08 PM
  5. Replies: 0
    Last Post: 06-14-2012, 12:38 PM
  6. Replies: 12
    Last Post: 02-14-2012, 01:26 AM
  7. Prevent Duplicate Entries
    By whousedmy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2010, 11:40 AM

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