两页中重复项的Google表格自定义公式

时间:2017-04-11 04:04:31

标签: validation google-sheets countif

我在Google电子表格的A栏数据验证框中输入了一个有效的自定义公式,禁止在同一列A中输入重复项。

  

= COUNTIF($ A $ 3:$ A $ 1677 A3)< = 1

现在我有另一列B列,我希望上述公式在A栏中从A栏移动,以便它提供以下方式:

    
+---+------------+-------------+
|   |     A      |      B      | <-- the custom formula to be kept in column B only (in the data validation box).
+---+------------+-------------+
| 1 | John       | MySQL       | <-- if this row/data is already existing, then
| 2 | John       | Oracle      | <-- this entry is allowed (bcoz the data in this row do not match with data in the above row (considering both columns), and
| 3 | Viv        | MySQL       | <-- this entry is also allowed (bcoz the data in this row also do not match with data in the above two rows (considering both columns), and
| 4 | Al         | SQL         | <-- this entry is also allowed (bcoz the data in this row also do not match with data in the above three rows (considering both columns), but,
| 5 | Viv        | MySQL       | <-- this entry is NOT allowed (bcoz the data in this row entirely match with data in one of the above rows - row no. 3 (considering both columns).       
+---+------------+-------------+

我已经修改了上述公式,如下所示:

  

= COUNTIF($ A $ 3:$ B $ 1677 B3)&LT; = 1

但它不符合上述第二个条件(Viv,MySQL)。

1 个答案:

答案 0 :(得分:2)

试试这个:

=COUNTIF(ARRAYFORMULA($A$3:$A$1677&$B$3:$B$1677),A3&B3)<=1

不是单独检查每个列,而是将这些值连接在一起并检查是否存在更多的连接字符串!

希望有所帮助!