基于excel中的多个字段条件更新结果

时间:2015-01-30 05:53:27

标签: excel field row cell

我目前的原始数据如下

OID   Version   Type    RAW      RESULT         
6064    2842    154     failed
6064    2843    154     passed
6064    2844    154     failed
544448  837     154     failed
544448  838     154     failed
544448  839     154     passed
544448  840     154     failed
544448  841     154     failed

我想在excel中有以下结果

预期

OID   Version   Type    RAW      RESULT         
6064    2842    154     failed   passed
6064    2843    154     passed   passed
6064    2844    154     failed   failed
544448  837     154     failed   passed
544448  838     154     failed   passed
544448  839     154     passed   passed
544448  840     154     failed   failed
544448  841     154     failed   failed

规则

相同的ID,相同的类型。如果更大版本的结果已通过,则标记所有较小版本的结果已通过(事件虽然在RAW中失败)

我刚试过Excel Lookup Formula with Two Conditions但没有运气

谢谢,

1 个答案:

答案 0 :(得分:0)

这应该可行,尽管根据您使用的数据量可能会有点麻烦:

=IF(COUNTIFS($A$2:$A$9,A2,$B$2:$B$9,">="&B2,$D$2:$D$9,"passed")>0,"passed","failed")

分解COUNTIFS功能

$A$2:$A$9,A2         ' returns true if OID matching A2 is found
$B$2:$B$9,">="&B2    ' returns true if any version  found which is greater than or equal to B2
$D$2:$D$9,"passed"   ' returns true if any RAW result is "passed"

COUNTIFS函数计算所有这三个条件都为真的行。如果大于0,则IF语句返回“已传递”,否则返回“失败”。