简体   繁体   English

嵌套的IF语句

[英]Nested IF statement

The following is something I have tried after some research on nested IF's however it only gives expected results for the first part of the statement and not the remainder, can anyone explain why or do I need a different type of function? 以下是我在对嵌套IF进行一些研究之后尝试过的方法,但是它仅给出了语句第一部分的预期结果,而没有给出其余部分的预期结果,有人可以解释为什么还是我需要其他类型的函数吗?

=if(h4="basic","basic",if(g17>=500,"Standard",if(h4="standard","Standard",if(g17>=750,"Standard+",if(g17<=500,"Basic",if(h4="Standard+","standard+",If(g17<=750,"Standard",if(g17>=850,"Platinum",if(h4="Platinum","Platinum",if(g17<=850,"Standard+","Platinum"))))))))))

Thanks for your assistance. 谢谢你的协助。

You have one if 如果你有一个

if(g17>=500

and later on you have 后来你有

if(g17>=750

The last condition will never be "satisfied", for if it is actually true, it will not be tested for, as the first if(g17>=500 will be True . 最后一个条件永远不会“满足”,因为如果它确实是真实的,则不会对其进行测试,因为第一个if(g17>=500将是True

I do not know what are the "expected results", "the first part of the statement", or "the remainder", but hopefully this helps. 我不知道什么是“预期结果”,“陈述的第一部分”或“其余部分”,但是希望这会有所帮助。

你可以试试这个

=IFERROR( INDEX({"basic","Standard","Standard+","Platinum"},MATCH(H4,{"basic","Standard","Standard+","Platinum"},0)),IF(G17>850,"Platinum",IF(G17>750,"Standard+",IF(G17>500,"Standard","Basic"))))

感谢您的建议,我认为自己的解释不是很好,但是最后一些建议可以解决,这里是完成的公式:

=IF(AND(H4="Basic",G17<450),"Basic",IF(AND(H4="Basic",G17>=450),"Standard",IF(AND(H4="Standard",G17<450),"Basic",IF(AND(H4="Standard",G17>449,G17<700),"Standard",IF(AND(H4="Standard",G17>=700),"Standard+",IF(AND(H4="Standard+",G17>699,G17<800),"Standard+",IF(AND(H4="Standard+",G17<700),"Standard",IF(AND(H4="Standard+",G17>=800),"Platinum",IF(AND(H4="Platinum",G17<800),"Standard+","Platinum")))))))))

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

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