+ Reply to Thread
Results 1 to 12 of 12

How to prevent duplicate entries in two columns with formulas?

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    11

    How to prevent duplicate entries in two columns with formulas?

    Friends,
    Although I have been a member for a while I rarely post. I usually just look for answers. But! I am stumped on this one! I have two columns; A:A has text and B:B has a numeric value. For each text there can only be one associated numeric value. There can however be duplicate text in column A:A, just cannot allow duplicate numeric value in column B:B. Can I prevent this with formulas or Data Validation? I THOUGHT I was savvy with excel. I stand corrected!

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: How to prevent duplicate entries in two columns with formulas?

    hi cody4334. assuming required data input in A2:B10, select from B2:B10 & go to Data -> Data Validation -> Allow: Custom -> Formula:
    =SUMPRODUCT(--($A$2:$A$10&$B$2:$B$10=A2&B2))=1

    is that what you need? so if column A has "ABC" appeared twice but column B has "1" & "2", it's ok. but if another "ABC" appears, column B cannot have "1" or "2"

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    04-28-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: How to prevent duplicate entries in two columns with formulas?

    Hi Cody,
    Find attached sheet. Is this sort of what you want? If duplicate number is entered in column B it will give an alert saying "duplicate"
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-10-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: How to prevent duplicate entries in two columns with formulas?

    Wow, thank you both for the help. Very quick! I have one more question. What if I have two columns with text and two with numeric value and I want to prevent duplicates as if the four columns were a group. IE both text columns were one designation and the numeric columns were another?

    I have attached an example in the book1 that moppyau sent. Thanks very much!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-10-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: How to prevent duplicate entries in two columns with formulas?

    Ok, I think I have attached a more clear picture of what I need. Hopefully! What are your thoughts?
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-28-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: How to prevent duplicate entries in two columns with formulas?

    Hi Cody. Looking at your example I don't think my method will work. I used data validation which won't let you enter the same number in the one column twice, it looks like you need to be able to have say 2 hats & 2 shoes, is that correct? I'll keep trying.

  7. #7
    Registered User
    Join Date
    08-10-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: How to prevent duplicate entries in two columns with formulas?

    That's correct, I need same commodities with different push orders. To keep FIFO in order.

  8. #8
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: How to prevent duplicate entries in two columns with formulas?

    still not sure i understood correctly. use the same instructions i mentioned but select E5:E15 instead. put in the custom formula:
    =SUMPRODUCT(--($D$5:$D$15&$E$5:$E$15=D5&E5))+SUMPRODUCT(--($H$5:$H$15&$I$5:$I$15=D5&E5))=1

    this links the table across too. that means the 2nd table cannot have Shoes with 1, since it already appeared. is that right? if it's not linked, then just:
    =SUMPRODUCT(--($D$5:$D$15&$E$5:$E$15=D5&E5))=1

    then in the 2nd table, select I5:I15 & do the same. but formula as:
    =SUMPRODUCT(--($D$5:$D$15&$E$5:$E$15=H5&I5))+SUMPRODUCT(--($H$5:$H$15&$I$5:$I$15=H5&I5))=1

    again, if it's not linked, then just:
    =SUMPRODUCT(--($H$5:$H$15&$I$5:$I$15=H5&I5))=1

  9. #9
    Registered User
    Join Date
    08-10-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: How to prevent duplicate entries in two columns with formulas?

    Ben, this worked perfectly, they were in fact linked! Sumproduct seems to be the most difficult for me to learn. Thank you very much!

  10. #10
    Registered User
    Join Date
    04-28-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: How to prevent duplicate entries in two columns with formulas?

    Your very clever Ben.

  11. #11
    Registered User
    Join Date
    07-02-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    2

    Re: How to prevent duplicate entries in two columns with formulas?

    please provide the example excel sheet

  12. #12
    Registered User
    Join Date
    07-02-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    2

    Re: How to prevent duplicate entries in two columns with formulas?

    Quote Originally Posted by benishiryo View Post
    still not sure i understood correctly. use the same instructions i mentioned but select E5:E15 instead. put in the custom formula:
    =SUMPRODUCT(--($D$5:$D$15&$E$5:$E$15=D5&E5))+SUMPRODUCT(--($H$5:$H$15&$I$5:$I$15=D5&E5))=1

    this links the table across too. that means the 2nd table cannot have Shoes with 1, since it already appeared. is that right? if it's not linked, then just:
    =SUMPRODUCT(--($D$5:$D$15&$E$5:$E$15=D5&E5))=1

    then in the 2nd table, select I5:I15 & do the same. but formula as:
    =SUMPRODUCT(--($D$5:$D$15&$E$5:$E$15=H5&I5))+SUMPRODUCT(--($H$5:$H$15&$I$5:$I$15=H5&I5))=1

    again, if it's not linked, then just:
    =SUMPRODUCT(--($H$5:$H$15&$I$5:$I$15=H5&I5))=1
    please provide the example excel sheet for the above...

+ 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