2017-03-03 51 views
0

我使用以下excel公式來確定單元格的值。我不斷收到「#VALUE!」錯誤。任何人都可以協助Excel OR/IF/AND St​​atement Error

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

回答

0

要嵌套所有的如果和不使用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

+0

感謝您的快速回復,但它仍然是不出來完全正確,請參閱新編問題,例1是怎麼出來的時候我刪除了或如你所說。例2是我需要的結果。我如何得到例2? – designspeaks

+0

你用過我的配方嗎?或者你的OR被刪除了,我重構了一下你的公式。 –

+0

@designspeaks您發佈的公式涉及第3行,我用它。您在第2行公佈了我的公式。我已經做了調整,請參閱編輯。在S2中發佈並複製下來。 –