+ Reply to Thread
Results 1 to 6 of 6

Allow values in a cell only if such values do not exist in the same column or row

  1. #1
    Registered User
    Join Date
    11-24-2012
    Location
    Spain
    MS-Off Ver
    Excel 2007
    Posts
    4

    Allow values in a cell only if such values do not exist in the same column or row

    Hi! I have a table which I wish to fill in with the values given in another table. The condition is that if for example, I enter C on cell G4, Excel, somehow should prevent or warn me that C is not allowed on G4 because that value is already in F4 (same row), it should also check the column. e.g. If I try to enter M on cell G4, Excel should inform me that M alredy exists on that column (G8).

    I'm a bit clueless on how to start. I thought about VBA, but I would prefer to use a formula.

    Any help will be greatly appreciated.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Allow values in a cell only if such values do not exist in the same column or row

    The following formula entered as Custom in Data Validation will do this for your layout:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and copied to all cells.

    Attached is implementation.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-24-2012
    Location
    Spain
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Allow values in a cell only if such values do not exist in the same column or row

    Thank you very much Jazzer! But how can I restrict the values entered to the list on column L only?

  4. #4
    Registered User
    Join Date
    11-24-2012
    Location
    Spain
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Allow values in a cell only if such values do not exist in the same column or row

    I added the OR:
    =AND(COUNTIF(E$2:E$8,E2)<=1,COUNTIF($E2:$H2,E2)<=1,OR(E2=L2,E2=L3,E2=L4,E2=L5,E2=L6,E2=L7,E2=L8,E2=L9,E2=L10))

    Could you show me a better way to do it?

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Allow values in a cell only if such values do not exist in the same column or row

    That will not work for your other cells. For that to work your references to L have to be absolute:

    ....E2=$L$2, E2=$L$3....

    Here's another way:

    =AND(COUNTIF(E$2:E$8,E2)<=1,COUNTIF($E2:$H2,E2)<=1,COUNTIF($L$2$L$10,E2)=1)

    Make sure you include all the $ signs as shown

  6. #6
    Registered User
    Join Date
    11-24-2012
    Location
    Spain
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Allow values in a cell only if such values do not exist in the same column or row

    I get it. Thank so much! It seems to be working perfectly well

+ 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. [SOLVED] Need to find if duplicate values exist in a column, concatenate cells and then delete
    By Siemieniuk in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-22-2017, 07:22 PM
  2. Vlookup with Match and Iferror for confirming is values exist in a column
    By Mr.Magoo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2014, 06:57 AM
  3. [SOLVED] Find if duplicate values exist in a column, concatenate cells and then de
    By filky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-15-2014, 10:14 PM
  4. Replies: 7
    Last Post: 12-07-2013, 02:33 PM
  5. Replies: 0
    Last Post: 09-11-2013, 09:54 AM
  6. Hide Row if no values exist in row column X through Y
    By 13reak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-15-2012, 03:35 PM
  7. Replies: 3
    Last Post: 03-08-2012, 03:32 PM

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