Google Sheet 两列重复项的自定义公式
Google Sheet Custom Formula for Duplicates in two columns
我在 Google 电子表格的 A 列的数据验证框中放置了一个有效的自定义公式,以禁止在同一列 A 中输入重复项。
=countif($A:$A77,A3)<=1
现在我有另一列 B 列,我希望将上面的公式从 A 列移动到 B 列,以提供以下内容的方式编辑它:
+---+------------+-------------+
| | 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:$B77,B3)<=1
但不满足上述第二个条件(Viv,MySQL)。
试试这个:
=COUNTIF(ARRAYFORMULA($A:$A77&$B:$B77),A3&B3)<=1
无需单独检查每一列,您只需将值连接在一起并检查是否存在超过一个连接字符串!
希望对您有所帮助!
我在 Google 电子表格的 A 列的数据验证框中放置了一个有效的自定义公式,以禁止在同一列 A 中输入重复项。
=countif($A:$A77,A3)<=1
现在我有另一列 B 列,我希望将上面的公式从 A 列移动到 B 列,以提供以下内容的方式编辑它:
+---+------------+-------------+
| | 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:$B77,B3)<=1
但不满足上述第二个条件(Viv,MySQL)。
试试这个:
=COUNTIF(ARRAYFORMULA($A:$A77&$B:$B77),A3&B3)<=1
无需单独检查每一列,您只需将值连接在一起并检查是否存在超过一个连接字符串!
希望对您有所帮助!