仅在满足范围之外的条件时才计算范围中的值

时间:2015-12-08 19:20:05

标签: excel excel-formula google-sheets spreadsheet

我有一个数据表,想要计算一个字符串在一个范围内显示的次数,所以我正在做=COUNTIF(C2:R100,"APPLE")并计算“APPLE”在{{1}范围内显示的次数通过C2。这很有效。

但是,我有另一列X,每行有百分比,如果该行的百分比高于50%,我只想计算“APPLE”。我尝试了R100,但得到范围不一样的错误。我还尝试了=COUNTIFS(C2:R100,"APPLE",X2:X100,">0.5")并收到范围不匹配范围大小的错误。

有没有办法在单个公式中执行此操作?

1 个答案:

答案 0 :(得分:2)

Try an old-fashioned SUMPRODUCT function alternative.

let mem (x : int) (set : t) =
    let rec loop = function
        | Node (l, k, r, _) ->
            let c = cmp_val k x in
            (contains k x) || loop (if c < 0 then l else r)
        | Empty -> false in
    loop set

You were almost there. SUMPRODUCT uses more directly mathematical formulation than a COUNTIF or COUNTIFS function.

    sump_countifs