If statement Excel嵌套-如果/和查询第二部分?

If statement Excel嵌套-如果/和查询第二部分?,if-statement,excel-formula,nested,If Statement,Excel Formula,Nested,嗨,我之前有个问题,我想我是在Richard的帮助下破解的,但是 我附上了一张图片,以及我试图实现的目标,以使我的查询更清晰 * 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

嗨,我之前有个问题,我想我是在Richard的帮助下破解的,但是

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

* 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 

这不是100%清楚,但听起来这就是你想要的:

F2=
=IF(E2=“Yes”,IF(或(D2=111,D2=112,D2=118,D2=119)=TRUE,D2,”,”)

G2=
=IF(和(E2=“Yes”,F2=111)=TRUE,C2“”)

H2=
=IF(和(E2=“Yes”,F2=112)=TRUE,C2“”)

I2=
=IF(和(E2=“Yes”,F2=118)=TRUE,C2“”

J2=
=IF(和(E2=“Yes”,F2=119)=TRUE,C2“”

那就填吧。我将
替换为
0
,因为如果没有到处都是零,就更容易看到发生了什么。一旦你对结果感到满意,你可以把它们改回去

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

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

谢谢Aubs,但我可以做这部分,即“是”选项,它是“否”选项,我需要在单元格中组合。这是每个部分的第三行吗?如果你不知道怎么做也不用担心,因为我真的很感激你的回答。再次感谢!将
更改为
0
这能满足您的需要吗?@Aubs您不需要将
和()。。。您只是添加了一个可能影响性能的进一步计算,它可能是
IF(FALSE=TRUE
IF(TRUE=TRUE
,无论哪种方式,它们都将返回相同的布尔值。@Richard Tompsett同意,但对于初学者,我更喜欢完整地写出它,以便他们能够理解正在发生的事情,并能够看到代码试图实现的目标。而不仅仅是查看与
ISNUMBER()相同的函数
等。显示预期结果是什么,在这种情况下,我在寻找
真的
,但同样,它也可能在寻找相反的结果,在这种情况下,您需要指定
假的
。到目前为止您尝试了什么?让我看看您正在尝试做什么,以便我可以引导您朝着正确的方向……编辑您尝试过的公式你的问题,给我一点提示☺