简体   繁体   English

在每个IF语句中使用真值或假值的excel嵌套IF中遇到麻烦

[英]Having trouble in nested IFs in excel with true or false values in each IF statement

=IF(AND(A2<=20151231),(B2=0) 0, 15, IF(AND(A2>=20190101,B2>=2),15, 7.5)) = IF(AND(A2 <= 20151231),(B2 = 0)0,15,IF(AND(A2> = 20190101,B2> = 2),15,7.5))

This is what I entered in the function. 这就是我在函数中输入的内容。

if A2 is less than 20151231 and B2 is equal to 0 the value will be 0. if A2 is greater than 20190101 and B2 is equal to or greater than 2 the value will be 15. 如果A2小于20151231并且B2等于0,则值将为0。如果A2大于20190101并且B2等于或大于2,则值将为15。

the problem is that excel says that I entered too many arguments and when I try to derive it it says that there is something wrong with the function I entered. 问题是excel表示我输入了太多参数,而当我尝试导出它时,则表示输入的函数有问题。

Try this: =IF(AND(A2<=20151231,B2=0),"0",IF(AND(A2>=20191010,B2>=2),15,"")) it seems your formula has too much close and open parenthesis. 试试这个:= IF(AND(A2 <= 20151231,B2 = 0),“ 0”,IF(AND(A2> = 20191010,B2> = 2),15,“”))看来您的公式太多了关闭和打开括号。 When using "and()" enclose all logic in one set of parenthesis. 使用“ and()”时,请将所有逻辑括在一组括号中。 Hope this helps. 希望这可以帮助。 Thanks 谢谢

Reymond's answer is correct, assuming that you want the result to be: 假设您希望结果为:Reymond的答案是正确的。

0   - if A2<=20151231 AND B2=0
15  - if A2>=20190101 AND B2>=2
7.5 - if neither of these cases are true.

If you are struggling to see what parameters you are passing to which function, I would suggest that you format your formulas so that they are easier to read: 如果您想查看将哪些参数传递给哪个函数,则建议您设置公式格式,以便于阅读:

=IF(
    AND(A2<=20151231, B2=0),
    0,  
    IF(
        AND(A2>=20190101,B2>=2),
        15, 
        7.5
    )
)

This makes it much easier to see what is going on and it can even be done in the excel formula bar if you wish (by using Alt+Enter): 这样可以更轻松地查看正在发生的事情,并且您可以根据需要甚至可以在excel公式栏中完成操作(使用Alt + Enter):

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM