如何限制重复数据输入

时间:2014-06-12 08:37:09

标签: excel excel-formula excel-2010

我希望为我的客户创建条件格式:

这将是我的数据:

     A           B
1: Name Ticket Number
2: Jack         123
3: Jack         123
4: Jack         123
5: Kimberly     456
6: Kimberly     123
7: Kimberly     456
8: Kurt         456
9: Kurt         587
10: Jack        123

我希望为特定客户创建一个名为Jack的条件格式。

例如,

  1. 如果Jack的票号为123,则票号不能重复给其他客户。如果其他客户使用相同的票号,则会突出显示名为的客户。

  2. 对于其他客户,Kurt和Kimberly或其他新入境客户,他们的票号可以反复使用。

  3. 特定客户杰克出现在顶部后,票号不会再次重复。例如,在B10中,票号应与其他号码一起输入,该号码与杰克杰克的票号和其他客票号不同。它应该是一个唯一的数字,如789.如果重复,则单元格将突出显示。

  4. 以下是我希望它的示例:

         A           B
    1: Name Ticket Number
    2: Jack         123      -> will not be highlighted
    3: Jack         123      -> will not be highlighted
    4: Jack         123      -> will not be highlighted
    5: Kimberly     456      -> will not be highlighted because it doesn't contain the same ticket number with Jack|123
    6: Kimberly     123      -> this will be highlighted because it contain same ticket number with Jack|123 
    7: Kimberly     456      -> will not be highlighted because it doesn't contain the same ticket number with Jack|123 
    8: Kurt         456      -> will not be highlighted because it doesn't contain the same ticket number with Jack|123 and Kurt can share the same ticket number with Kimberly or others customers besides than Jack
    9: Kurt         587      -> will not be highlighted because it doesn't contain the same ticket number with Jack|123 
    10: Jack        123      -> will be highlighted because ticket number 123 is appear on the top of the list(B2:B4), it should contain a new ticket number after few customer have being insert after Jack on B2:B4
    11: Jack        789      -> will not be highlighted because it doesn't contain the same ticket number with Jack on B2:B4 after few customer being insert in the middle and ticket number 789 is different with others customer as well.
    

    谢谢。

1 个答案:

答案 0 :(得分:0)

如上所述,下面的公式将突出显示任何共享Jack持有的任何票号的客户。

=IF($A2<>"JACK",IF(ISERROR(MATCH($B2,IF($A$2:A$11="JACK",$B$2:B$11,""),0)),FALSE,TRUE))