我可以在 google 工作表的 IFS 函数中使用二元运算符 OR 和 AND 吗?

Can I use binary operators OR, AND inside an IFS function in google sheets?

我正在跟踪为小孩子编写教科书的进度。本书共20章,每章包含2个活动。 负责人提出了 5 种类型的活动,由于有 20 个章节,我们必须确保每对类型恰好出现两次。我们也不能写一个章节,其中 2 个活动属于同一类型。由于有多个作者,我打算解决这个问题的方法是在相邻行和另一行的每一章中记录 activity 1 和 activity 2,有一个将它们分类为“组合”的公式1 - 10"。我想出了这个,但我得到了#ERROR!消息,当我将鼠标悬停在它上面时出现“公式解析错误”。我试着看看我是否能找到错误,但没有。这是我的公式,为了便于阅读而缩进(在我的电子表格中,我删除了所有制表符和所有不在引号内的空格):

ifs(
    or(
        and(
            G2="Avalie as afirmativas"; 
            h2="Ligue os grupos"
        ); 
        and(
            h2="Avalie as afirmativas"; 
            g2="Ligue os grupos"
        )
    ),"Combinação 1",
    or(
        and(
            G2="Avalie as afirmativas"; 
            h2="Desenhe alguma coisa"
        ); 
        and(
            h2="Avalie as afirmativas"; 
            g2="Desenhe alguma coisa"
        )
    ),"Combinação 2",
    or(
        and(
            G2="Avalie as afirmativas"; 
            h2="Circule os desenhos"
        ); 
        and(
            h2="Avalie as afirmativas"; 
            g2="Circule os desenhos"
        )
    ),"Combinação 3",
    or(
        and(
            G2="Avalie as afirmativas"; 
            h2="Colagem"
            ); 
        and(
            h2="Avalie as afirmativas"; 
            g2="Colagem"
        )
    ),"Combinação 4",
    or(
        and(
            G2="Desenhe alguma coisa"; 
            h2="Ligue os grupos"
        ); 
        and(
            h2="Desenhe alguma coisa";
            g2="Ligue os grupos"
        )
    ),"Combinação 5",
    or(
        and(
            G2="Circule os desenhos";
            h2="Ligue os grupos"
        ); 
        and(
            h2="Circule os desenhos";
            g2="Ligue os grupos"
        )
    ),"Combinação 6",
    or(
        and(
            G2="Colagem"; 
            h2="Ligue os grupos"
        ); 
        and(
            h2="Colagem";
            g2="Ligue os grupos"
        )
    ),"Combinação 7",
    or(
        and(
            G2="Desenhe alguma coisa"; 
            h2="Circule os desenhos"
        ); 
        and(
            h2="Desenhe alguma coisa"; 
            g2="Circule os desenhos"
        )
    ),"Combinação 8",
    or(
        and(
            G2="Desenhe alguma coisa"; 
            h2="Colagem"
        ); 
        and(
            h2="Desenhe alguma coisa"; 
            g2="Colagem"
        )
    ),"Combinação 9",
    or(
        and(
            G2="Circule os desenhos"; 
            h2="Colagem"
        ); 
        and(
            h2="Circule os desenhos"; 
            g2="Colagem"
        )
    ),"Combinação 10")

我做了一些挖掘,认为可能与逗号和分号有关,但这些似乎都是正确的,所以我的下一个猜测是 IFS() 不将 OR() 作为参数,或者 OR() 可能不将 AND() 作为参数。 None 我找到的 IFS 教程都讲过这个,所以我想问一下。

编辑:由于时间限制,我最终使用了 player0 的解决方案,但深入挖掘后我发现了问题所在:在我的国家/地区,我们使用逗号作为小数点分隔符。因此,工作表中任何公式中的每个参数都必须用分号分隔。所以最后它实际上是逗号和分号。有趣的是,由于我已经用英文配置了 google,在官方 google 工作表支持页面上出现了用逗号分隔参数的公式,分号是我在 third-party 教程中找到的开始,只有当我尝试使用 COUNTIF 并得到完全相同的错误时它才会点击,并且在表格支持论坛上发现了一个问题,其中有人引用了这个。谢谢你们的意见!

使用:

=ARRAYFORMULA(
 IF((REGEXMATCH(G2:G; "Avalie as afirmativas|Ligue os grupos"))*
    (REGEXMATCH(H2:H; "Avalie as afirmativas|Ligue os grupos"));      "Combinação 1";
 IF((REGEXMATCH(G2:G; "Avalie as afirmativas|Desenhe alguma coisa"))*
    (REGEXMATCH(H2:H; "Avalie as afirmativas|Desenhe alguma coisa")); "Combinação 2";
 IF((REGEXMATCH(G2:G; "Avalie as afirmativas|Circule os desenhos"))*
    (REGEXMATCH(H2:H; "Avalie as afirmativas|Circule os desenhos"));  "Combinação 3";
 IF((REGEXMATCH(G2:G; "Avalie as afirmativas|Colagem"))*
    (REGEXMATCH(H2:H; "Avalie as afirmativas|Colagem"));              "Combinação 4";
 IF((REGEXMATCH(G2:G; "Desenhe alguma coisa|Ligue os grupos"))*
    (REGEXMATCH(H2:H; "Desenhe alguma coisa|Ligue os grupos"));       "Combinação 5";
 IF((REGEXMATCH(G2:G; "Circule os desenhos|Ligue os grupos"))*
    (REGEXMATCH(H2:H; "Circule os desenhos|Ligue os grupos"));        "Combinação 6";
 IF((REGEXMATCH(G2:G; "Colagem|Ligue os grupos"))*
    (REGEXMATCH(H2:H; "Colagem|Ligue os grupos"));                    "Combinação 7";
 IF((REGEXMATCH(G2:G; "Desenhe alguma coisa|Circule os desenhos"))*
    (REGEXMATCH(H2:H; "Desenhe alguma coisa|Circule os desenhos"));   "Combinação 8";
 IF((REGEXMATCH(G2:G; "Desenhe alguma coisa|Colagem"))*
    (REGEXMATCH(H2:H; "Desenhe alguma coisa|Colagem"));               "Combinação 9";
 IF((REGEXMATCH(G2:G; "Circule os desenhos|Colagem"))*
    (REGEXMATCH(H2:H; "Circule os desenhos|Colagem"));                "Combinação 10";
 )))))))))))