Excel OR / IF / AND语句错误

时间:2017-03-03 20:01:21

标签: excel if-statement formula

我使用以下excel公式来确定单元格的值。我一直得到一个" #VALUE!"错误。有人可以帮忙吗?

enter image description here

=OR(IF(AND(P3="NewEE",LEFT(O3,1)="D"),"DENTAL",IF(AND(P3="BEN2",LEFT(O3,1)="H"),"MEDICAL",
IF(AND(P3="BEN3",LEFT(O3,1)="V"),"VISION"))),IF(AND(Q3="NewEE",LEFT(O3,1)="D"),"DENTAL",
IF(AND(Q3="BEN2",LEFT(O3,1)="H"),"MEDICAL",IF(AND(Q3="BEN3",LEFT(O3,1)="V"),"VISION"))),
IF(AND(R3="NewEE",LEFT(O3,1)="D"),"DENTAL",IF(AND(R3="BEN2",LEFT(O3,1)="H"),"MEDICAL",
IF(AND(R3="BEN3",LEFT(O3,1)="V"),"VISION"))))

示例1:

enter image description here

示例2:

enter image description here

1 个答案:

答案 0 :(得分:0)

您希望嵌套所有ifs而不使用OR():

=IF(AND(P2="NewEE",LEFT(O2,1)="D"),"DENTAL",IF(AND(P2="BEN2",LEFT(O2,1)="H"),"MEDICAL",IF(AND(P2="BEN3",LEFT(O2,1)="V"),"VISION",IF(AND(Q2="NewEE",LEFT(O2,1)="D"),"DENTAL",IF(AND(Q2="BEN2",LEFT(O2,1)="H"),"MEDICAL",IF(AND(Q2="BEN3",LEFT(O2,1)="V"),"VISION",IF(AND(R2="NewEE",LEFT(O2,1)="D"),"DENTAL",IF(AND(R2="BEN2",LEFT(O2,1)="H"),"MEDICAL",IF(AND(R2="BEN3",LEFT(O2,1)="V"),"VISION","")))))))))

enter image description here