我正在寻找将几个不同的If(or(和语句)串在一起的方法。基本上是为了满足and要求之一将字母表分为3个不同的部分。A-G,H-M和N-Z 我的第一个(如下所示)工作正常。当E4满足字母要求中指定的要求之一时,给我期望的结果;
= IF(OR((AND(B4 =“ Operational”,LEFT(E4,1)=“ A”),AND(B4 =“ Operational”,LEFT(E4,1)=“ B”),AND (B4 =“ Operational”,LEFT(E4,1)=“ C”),AND(B4 =“ Operational”,LEFT(E4,1)=“ D”),AND(B4 =“ Operational”,LEFT(E4 ,1)=“ E”),AND(B4 =“ Operational”,LEFT(E4,1)=“ F”),AND(B4 =“ Operational”,LEFT(E4,1)=“ G”)), “业务 数据库1 A-G“,”“)
然后我尝试标记另一个if(or(And语句,并收到#value错误。
= IF(OR((AND(B4 =“ Operational”,LEFT(E4,1)=“ A”),AND(B4 =“ Operational”,LEFT(E4,1)=“ B”),AND (B4 =“ Operational”,LEFT(E4,1)=“ C”),AND(B4 =“ Operational”,LEFT(E4,1)=“ D”),AND(B4 =“ Operational”,LEFT(E4 ,1)=“ E”),AND(B4 =“ Operational”,LEFT(E4,1)=“ F”),AND(B4 =“ Operational”,LEFT(E4,1)=“ G”)), “业务 数据库1 AG“,”“),IF(OR(AND(B4 =” Operational“,LEFT(E4,1)=” H“),AND(B4 =” Operational“,LEFT(E4,1)=” I“) ,AND(B4 =“ Operational”,LEFT(E4,1)=“ J”),AND(B4 =“ Operational”,LEFT(E4,1)=“ K”),AND(B4 =“ Operational”,LEFT (E4,1)=“ L”),AND(B4 =“ Operational”,LEFT(E4,1)=“ M”))),“操作 数据库1 H-M“,”“))
有什么想法吗?
答案 0 :(得分:2)
您的原始配方可以大大减少。这是两个例子。
=IF(AND(B4="Operational", CODE(LEFT(E4))>=65, CODE(LEFT(E4))<=71), "Operations Database 1 A-G", IF(AND(B4="Operational", CODE(LEFT(E4))>=72, CODE(LEFT(E4))<=77), "Operations Database 1 H-M", ""))
=IF(AND(B4="Operational", OR(LEFT(E4)={"A","B","C","D","E","F","G"})), "Operations Database 1 A-G", IF(AND(B4="Operational", OR(LEFT(E4)={"H","I","J","K","L","M"})), "Operations Database 1 H-M", ""))
这使上述公式更容易添加您的新条件。
=IF(B4="Operational", "Operations Database 1 "&INDEX({"A-G","H-M","N-Z"}, MATCH(LEFT(E4), {"A","H","N"})), "")
通过查找静态数组可以实现进一步的整合。
{{1}}