How to nest IF block with OR statement in Google Spreadsheet

夙愿已清 提交于 2021-02-05 11:32:53

问题


I'm looking for some help with this little code that I'm using in Google spreadsheet:

 =ArrayFormula(IF(OR(F2:F="Cancelled",G2:G="Cancelled"),"Cancelled",IF(F2:F="Finished",20,)+IF(G2:G="Finished",20,)))

For some reason it works if I use this code without calling multiple rows:

=ArrayFormula(IF(OR(F2="Cancelled",G2="Cancelled"),"Cancelled",IF(F2="Finished",20,)+IF(G2="Finished",20,)))

Does anyone have an idea which is the correct way to use it?

Thanks in advance.


回答1:


OR merges all TRUEs to one value and does not maintain array size.

You need to use + instead of OR; Like,

=ARRAYFORMULA(IF((F2:F="Cancelled")+(G2:G="Cancelled"), "Cancelled".... ))


来源:https://stackoverflow.com/questions/46591324/how-to-nest-if-block-with-or-statement-in-google-spreadsheet

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