【问题标题】:How to use multiple isblank statements inside an if statement如何在 if 语句中使用多个 isblank 语句
【发布时间】:2012-11-08 23:15:50
【问题描述】:

是否可以在 if 语句中使用多个 isblank 语句。我想使用类似 sudocode 的东西

=if(isblank(g8)&isblank(h8), "both blank", "not both blank")
=if(isblank(g8&h8), "both blank", "not both blank")

这些函数返回 $VALUE 错误或在 if 语句中返回错误的文本。

有没有办法做到这一点?

【问题讨论】:

  • 供将来参考基本IF 陈述问题更适合超级用户
  • 那说稍加调整你的第二个公式会导致更短的结果=IF(LEN(G8&H8)=0, "both blank", "not both blank")

标签: excel if-statement


【解决方案1】:
=if(AND(isblank(g8),isblank(h8)), "both blank", "not both blank")

【讨论】:

  • 我认为这可以扩展为两个以上,也可以合并到一个大的嵌套 if/else 循环中?
  • 在 Excel2007 及更高版本中,AND() 最多可以使用 255 个参数。它可以像任何其他函数一样嵌套/组合。
【解决方案2】:

如果您的范围是连续的,则使用以下公式将采用您想要的任意数量的参数,并且在您扩大范围时键入更容易的语法:

=if(counta(g8:h8)=0, "both blank", "not both blank")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-29
    • 2023-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 1970-01-01
    • 2015-01-26
    相关资源
    最近更新 更多