根据 excel 中的许多字段条件更新结果

Update result based on many fields condition in excel

我目前有如下原始数据

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 但运气不好

谢谢,

这应该可行,尽管它可能会有点麻烦,具体取决于您处理的数据量:

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

分解 COUNTIFS 函数

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

COUNTIFS 函数对所有 3 个条件都为真的行进行计数。如果大于0,则IF语句returns"passed",否则returns"failed".