简体   繁体   English

Google表格:如何使用MATCH函数创建嵌套的IF语句?

[英]Google Sheets: How to create a nested IF statement with MATCH function?

I have been looking for a solution to this for quite a few hours, but unfortunately I appear to be stuck. 我一直在寻找解决方案,已经有好几个小时了,但不幸的是,我似乎被困住了。 I am trying to automatically input data based on another sheet with three possible options. 我正在尝试基于具有三个可能选项的另一张纸自动输入数据。 DEADLINE , PMC or FMC , but it keeps crashing with if it can't find the first result. DEADLINEPMCFMC ,但是如果找不到第一个结果,它将不断崩溃。 It will say #N/A , and tells me it can't find the first value. 它会显示#N #N/A ,并告诉我找不到第一个值。 Why doesn't it check for the other values? 为什么不检查其他值?

=IFS((MATCH(J8,Faults!F3:F9,0)),"DEADLINE",(MATCH(J6,Faults!F3:F9,0)),"PMC",(MATCH(J4,Faults!F3:F9,0)),"FMC")

Thanks in advance 提前致谢

MATCH does not return TRUE or FALSE. MATCH不返回TRUE或FALSE。 It either returns a number (the position within the range) or a #N/A error. 它返回一个数字(范围内的位置)或一个#N / A错误。

IFS will throw an error and stop processing just as a nested IF will. IFS将引发错误并停止处理,就像嵌套的IF一样。 Wrap all the match functions in ISNUMBER to bypass thrown #N/A errors on no match. 在ISNUMBER中包装所有匹配函数,以在没有匹配项时绕过抛出的#N / A错误。

=IFS(isnumber(MATCH(J8, Faults!F3:F9, 0)),"DEADLINE", isnumber(MATCH(J6, Faults!F3:F9, 0)), "PMC", isnumber(MATCH(J4, Faults!F3:F9, 0)), "FMC", true, "other")

I've added a default of Other if none of the three matches are found. 如果找不到三个匹配项,则添加了默认值Other

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

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