将值合并到聚合列中

时间:2013-03-18 18:00:34

标签: excel if-statement excel-formula worksheet-function countif

我有一个包含5列的电子表格

+----+----+----+----+-------------+
| C1 | C2 | C3 | C4 | C-Aggrogate |
+----+----+----+----+-------------+
|YES |    |    |    | YES         |
|    |YES |    |    | YES         |
|    |    |YES |    | YES         |
|    |    |    |YES | YES         |
|YES |YES |    |    | YES         |
|YES |    |NO  |    | MAYBE       |
|YES |YES |NO  |    | MAYBE       |
|YES |YES |NO  |NO  | MAYBE       |
|NO  |    |    |    | NO          |
|    |NO  |    |    | NO          |
|    |    |NO  |    | NO          |
|    |    |    |NO  | NO          |
+----+----+----+----+-------------+

列C1-C4是来自其他来源的静态数据。 C-Aggrogate旨在激活其他列,并在可能存在差异时突出显示。

给定行的规则是:

  1. 如果所有列都为空,则C-Aggrogate为空
  2. 如果至少有一列且没有列,则C-Aggrogate
  3. 如果至少有一列且没有列,则C-Aggrogate
  4. 如果至少有一列并且至少有一列,那么C-Aggrogate MAYBE
  5. 我将从哪里开始为C-Aggrogate创建正确的公式? YES,NO,MAYBE是最合适的样本值,它们可以是任何人类可读的值。

1 个答案:

答案 0 :(得分:1)

不漂亮,但似乎符合您的要求:

=IF(AND(COUNTIF(A1:D1,"YES")>0,COUNTIF(A1:D1,"NO")=0),"YES",
 IF(AND(COUNTIF(A1:D1,"NO")>0,COUNTIF(A1:D1,"YES")=0),"NO",
 IF(AND(COUNTIF(A1:D1,"YES")=0,COUNTIF(A1:D1,"NO")=0),"","MAYBE")))