代码之家  ›  专栏  ›  技术社区  ›  brettkelly

Excel公式中嵌套的IF语句

  •  1
  • brettkelly  · 技术社区  · 16 年前

    =IF( AND(D6=FALSE, OR(ISBLANK(B10),B10=0) ),IF( AND(D6=TRUE,B10>=1)," ","Enter number of components"),"fail")
    

    6 回复  |  直到 16 年前
        1
  •  2
  •   BoltClock    14 年前

    在我看来,你可能只想评估一次

    =IF( AND(D6=FALSE, OR(ISBLANK(B10),B10=0) ), "Enter number of components", "Fail")
    
        2
  •  1
  •   Andrew Scagnelli    16 年前

        3
  •  1
  •   Joel Goodwin    16 年前

    if (D6 is false & B10 is blank)
         then if (D6 is true & B10 >= 1)
              then "" THIS WILL NEVER HAPPEN
              else "Enter number of components"
    else "fail"
    
        4
  •  0
  •   Pesto    16 年前

    首先,让我们看看代码的结构:

    if D6 = false AND (isblank(B10) OR B10 = 0)
      if D6 = true AND B10 >= 1
        put " "
      else
        put "Enter number of components"
    else
      put "fail"
    

    =IF(AND(D6=TRUE, OR(ISBLANK(B10), B10=0)), "Enter number of components", "fail")
    

    这不是你想要的吗?

        5
  •  0
  •   James Eichele Bernard Igiri    16 年前

    =IF(OR(ISBLANK(B10),B10=0),"Enter number of components",IF(B10<1,"Fail",""))
    

    如果我理解正确,你想:

  • 当单元格B10为空或为零时显示“输入组件数量”
  • 在所有其他情况下,不显示任何内容(“”)

    上面的陈述呼应了同样的逻辑。

  •     6
  •  -1
  •   brettkelly    16 年前

    事实证明,这完成了工作:

    =IF( OR( AND(D6=TRUE,  OR(ISBLANK(B10),B10=0)), AND(D6=FALSE, OR(B10>=1))), "Selection Invalid","")
    

    推荐文章