嵌套的IF语句查询,可能与括号

时间:2018-05-16 17:41:42

标签: excel if-statement excel-formula

任务

我试图使用嵌套的IF语句将一些变量重新编码为3个单独的变量。我已经将嵌套的If语句一起编写,并且Excel允许我输入它(即没有抛出错误消息)。问题是公式无法正常工作,因为它没有正确读取数据。变量没有填写,例如,碰撞,应该在公式应用时出现,人身伤害事件也应该出现。但是,只有Slip Trip Fall出现了。

因此,想象一下数据集,第一列是原始形式的数据,第二列是公式(错误地)创建的。第二列应该是1,3,4等,与分类应该是一致的。

第一栏 1
4
5
6
2

Col二

1

1

1

1

我的代码是:

=IF(ISNUMBER(MATCH(C6,{"Slip Trip Fall","Fall down Stairs","Knock, Trip or Fall within bus"},0)),"Slip Trip Fall",IF(ISNUMBER(MATCH(C6,{"Alighting incident","Boarding incident","Struck by object","Personal Injury Event","Wheelchair / Buggy incident"},0)),"Personal Injury Event",IF(ISNUMBER(MATCH(C6,{"Collision","Collision incident"},0)),"Personal Injury Event")))

和ELSE语句(基本相同) =IF(ISNUMBER(MATCH(C6,{"Slip Trip Fall","Fall down Stairs","Knock, Trip or Fall within bus"},0)),"Slip Trip Fall",ELSEIF(ISNUMBER(MATCH(C6,{"Alighting incident","Boarding incident","Struck by object","Personal Injury Event","Wheelchair / Buggy incident"},0)),"Personal Injury Event",ELSEIF(ISNUMBER(MATCH(C6,{"Collision","Collision incident"},0)),"Personal Injury Event")))

0 个答案:

没有答案