【问题标题】:Update result based on many fields condition in excel根据excel中的多个字段条件更新结果
【发布时间】:2015-01-30 05:53:26
【问题描述】:

我目前有如下原始数据

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,但没有成功

谢谢,

【问题讨论】:

    标签: excel field row cell


    【解决方案1】:

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

    =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语句返回“通过”,否则返回“失败”。

    【讨论】:

    • 它运行有点慢(因为我的数据 ~ 100 000 行),但它运行完美
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-30
    • 2023-03-10
    • 2020-07-30
    • 1970-01-01
    • 2013-07-13
    • 2021-02-16
    相关资源
    最近更新 更多