Nested IF statement

放肆的年华 提交于 2019-12-11 04:14:48

问题


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(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.


回答1:


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.

I do not know what are the "expected results", "the first part of the statement", or "the remainder", but hopefully this helps.




回答2:


You can try this

=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"))))



回答3:


Thanks for the advice I do not think I explained myself too well, but in the end with some of the suggestions was able to work it out here is the finished formula:

=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")))))))))


来源:https://stackoverflow.com/questions/19911872/nested-if-statement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!