在Excel中使用嵌套的If语句我一直在尝试使用以下标准获取结果:
在100和75000伏之间,但应接受11; 22; 25; 26; 30; 33; 66 因为它们将以kV为单位
源数据位于表Transformers
中,公式还返回另外两个表MASTER
和META
的数据。
我已经尝试了以下各种IF/AND/OR
变体,但是之前我很少使用嵌套的if语句,所以我不在逻辑上。任何帮助感激不尽!
谢谢
=IF(MASTER!N2="Failed Check 1","Failed Check 1",IF(META!N2="Failed Check 2","Failed Check 2"), IF(OR(Transformers!T2>=110, Transformers!T2<=75000) OR(Transformers!T2=11, Transformers!T2=22, Transformers!T2=25, Transformers!T2=26, Transformers!T2=30, Transformers!T2=33, Transformers!T2=66),"Failed Check 3","Passed Check 3"))
谢谢
答案 0 :(得分:2)
看起来你需要一个AND作为你OR中的第一个词。括号也看起来不正确。一旦复杂度达到某个阶段,有时候有助于在带有空格的记事本中组合公式来显示逻辑:
=IF(MASTER!N2="Failed Check 1",
"Failed Check 1",
IF(META!N2="Failed Check 2",
"Failed Check 2",
IF(OR(
AND(Transformers!T2>=110, Transformers!T2<=75000),
Transformers!T2=11,
Transformers!T2=22,
Transformers!T2=25,
Transformers!T2=26,
Transformers!T2=30,
Transformers!T2=33,
Transformers!T2=66
),
"Failed Check 3",
"Passed Check 3"
)
)
)
没有换行符,这是:
=IF(MASTER!N2="Failed Check 1","Failed Check 1",IF(META!N2="Failed Check 2","Failed Check 2", IF(OR(AND(Transformers!T2>=110, Transformers!T2<=75000),Transformers!T2=11, Transformers!T2=22, Transformers!T2=25, Transformers!T2=26, Transformers!T2=30, Transformers!T2=33, Transformers!T2=66),"Failed Check 3","Passed Check 3")))
答案 1 :(得分:0)
根据您的条件,我建议您实施此单线程,假设您的数据位于单元格A1中。
=IF(OR(AND(A1>=100,A1<=75000),A1=11,A1=22,A1=25,A1=26,A1=30,A1=33,A1=66),TRUE,FALSE)
虽然这只返回TRUE或FALSE,但不会告诉你它已经通过了哪个检查。
答案 2 :(得分:0)
=IF(MASTER!N2="Failed Check 1","Failed Check 1",IF(META!N2="Failed Check 2","Failed Check 2", IF(OR(Transformers!T2>=110, Transformers!T2<=75000, Transformers!T2=11, Transformers!T2=22, Transformers!T2=25, Transformers!T2=26, Transformers!T2=30, Transformers!T2=33, Transformers!T2=66),"Failed Check 3","Passed Check 3")))
答案 3 :(得分:0)
公式中的一些问题:
OR
逗号丢失之前,它应为),OR(
OR
的右括号,它应该是...=66)),...
缺少IF
的右括号,您的公式应该以{{1}}
+1您要查找100到75000之间的值,可以使用)))
代替AND
为了简化您的公式,您可以将有效的kV值放在一个范围内并参考它;我们称之为OR
(每个单元格一个值,无论是一行还是一列)
简化公式:
kVolts