Excel嵌套 - IF / AND查询第二部分?

时间:2018-04-16 15:47:59

标签: if-statement excel-formula nested

您好我之前有过查询,并且认为我已经在理查德的帮助下破解了它,it doesn't appear

e

我附上了一张图片以及我想要实现的目标,以使我的查询更加清晰。

* If E is correct then cell F will be set to match D manually               
* If E is yes and F is set to 111 then G will populate with the contents of C               
* If E is no and F is set to anything but 111 then it will return 0                 


* If E is correct then cell F will be set to match D manually               
* If E is yes and F is set to 112 then H will populate with the contents of C               
* If E is no and F is set to anything but 112 then it will return 0                 


* If E is correct then cell F will be set to match D manually               
* If E is yes and F is set to 118 then I will populate with the contents of C               
* If E is no and F is set to anything but 118 then it will return 0                 


* If E is correct then cell F will be set to match D manually               
* If E is yes and F is set to 119 then J will populate with the contents of C               
* If E is no and F is set to anything but 119 then it will return 0 

1 个答案:

答案 0 :(得分:0)

它不是100%清晰,但听起来像你之后的那样:

Table

F2 = =IF(E2="Yes",IF(OR(D2=111,D2=112,D2=118,D2=119)=TRUE,D2,""),"")

G2 = =IF(AND(E2="Yes",F2=111)=TRUE,C2,"")

H2 = =IF(AND(E2="Yes",F2=112)=TRUE,C2,"")

I2 = =IF(AND(E2="Yes",F2=118)=TRUE,C2,"")

J2 = =IF(AND(E2="Yes",F2=119)=TRUE,C2,"")

然后填写。我已经""而不是0,因为它更容易看到在没有零的情况下发生了什么。一旦您对结果感到满意,您就可以将其更改回来。

顺便说一下,有时解析代码更容易。如果您在不同的行上有代码,Excel可以正常工作,如下面的D2:

=
  IF(
    E2="Yes",
    IF(
      OR(
        D2=111,D2=112,D2=118,D2=119
        )=TRUE,
      D2,
      ""
    ),
    ""
  )