多重标准

时间:2015-07-23 14:45:30

标签: excel excel-formula

是否可以将IF语句用于多个条件?或者我最好用什么......我试图用我想要的东西修改问题代码在这方面是不正确的,但它可能会突出更多我希望实现的目标。

如果(A3 =“狗”,“狗绿”,“狗蓝”),匹配,则不匹配)

出于某种原因,它不会让我上传图片....

非常感谢任何帮助/建议

3 个答案:

答案 0 :(得分:2)

这肯定有用:

=IF(OR(A3="Dog",A3="Dog Green",A3="Dog Blue"),"Matches","doesn’t match")

IF语句中的广告OR语句 别忘了也使用引号

答案 1 :(得分:1)

这是一个你可以在google上找到的简单公式:

=ISNUMBER(FIND("dog",A1))

如果狗在A1中,则返回True;如果不在,则返回false。

进一步阅读(解释清楚)https://exceljet.net/formula/cell-contains-specific-text

此外,在我看来,这是一个单一的标准。多重标准是什么意思?

答案 2 :(得分:1)

有许多方法可以在Excel中测试多个条件。可能最容易的是:

使用AND / OR BOOLEAN操作符。 AND(test1,test2 ...)检查是否每个test1& test2为TRUE(可以根据需要保存多个参数)。即:

=if(And(A1="dog",B1="cat"),"there is a cat and a dog", "there is not both a cat and a dog")

OR(test1,test2)检查test1是否为TRUE,或test2为TRUE,或两者都为真。即:

=if(Or(A1="dog",B1="cat"),"There is either a cat, or there is a dog, or both","there is neither a cat nor a dog")

另一个广泛的选择是'窝''一个IF声明在另一个内部。即:

=if(A1="dog","There is a dog. Have not checked for cats",if(B1="cat","A1 is not a dog, and also B1 is a cat","There is neither a cat nor a dog"))

如果您有更具体的问题,您应该使用所有可能的详细信息更新您的问题。