vba 如果是假的,什么都不做?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24895679/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 03:57:17  来源:igfitidea点击:

If false, do nothing?

excelvbaformulas

提问by Matthew Macri

I'm attempting to make an excel formula do nothing if a cell is blank, is this possible?

如果单元格为空白,我正在尝试使 Excel 公式不执行任何操作,这可能吗?

This is the formula as it stands, could I nest an if statement that checks if F4 & G4 are blank and if they are it doesn't perform this formula?

这是目前的公式,我可以嵌套一个 if 语句来检查 F4 和 G4 是否为空白,如果是,则不执行此公式吗?

=IF(F4 < G4, G4 - F4, TODAY() - F4)

...

...

Thanks!

谢谢!

回答by tigeravatar

=IF(F4&G4="","",IF(F4<G4,G4-F4,TODAY()-F4))

=IF(F4&G4="","",IF(F4<G4,G4-F4,TODAY()-F4))

回答by Matthew Macri

Figured it out...

弄清楚了...

=IF(F4 = "", "", IF(F4 < G4, G4 - F4, TODAY() - F4))

Woooooohoooooo

呜呜呜呜

回答by Josh

Try this: =IF(A1="M", "MALE", IF(A1="F", "FEMALE", "N/A"))Unfortunately, it's a bit verbose, but it will do what you need.

试试这个:=IF(A1="M", "MALE", IF(A1="F", "FEMALE", "N/A"))不幸的是,它有点冗长,但它会做你需要的。

I hope this helps.

我希望这有帮助。

Josh

乔希