简体   繁体   English

如何使Excel的“ IF”公式将空白单元格计算为“ 0”?

[英]How to make Excel “IF” formula calculate blank cells as “0”?

How do I make the IF function consider blank cells as "0". 如何使IF函数将空白单元格视为“ 0”。

Here is the formula I am using in the H column cells: IF(E1>F1,"YES","NO") 这是我在H列单元格中使用的公式:IF(E1> F1,“ YES”,“ NO”)

Here is the specific Example: 这是具体示例:

E | E | F |G | F | G | H | H |

10 | 10 | 0 |30 | 0 | 30 | YES | 是的

10 | 10 | 5 |10 | 5 | 10 | YES | 是的

10 |-------|-------| 10 | ------- | ------- | NO | 否|

H3 should return "YES" I would think. 我认为H3应该返回“是”。

In this scenario I cannot change the blank cells to "0", they have to remain blank. 在这种情况下,我不能将空白单元格更改为“ 0”,它们必须保持空白。

What would be the correct formula for me to use? 我使用的正确公式是什么?

I have tried searching around on google and stackoverflow, but the only things I can find are where people are trying to NOT have blanks be considered "0". 我曾尝试在google和stackoverflow上搜索,但是我唯一能找到的就是人们在尝试不让空格为“ 0”的地方。

The excel handles automatically for blank cells . Excel会自动处理空白单元格。

If you enter text it will show error and suggest for correction. 如果输入文字,它将显示错误并建议更正。 the formaula i use in this examle is 我在这个例子中使用的公式是

=IF(A1>=B1,"Yes","No")

The result appear as follow 结果如下

在此处输入图片说明

=IF(ISBLANK(F1),"YES",IF(E1>F1,"YES","NO")) - Will check for a blank cell, this will work if column F is not formulated =IF(ISBLANK(F1),"YES",IF(E1>F1,"YES","NO")) -将检查空白单元格,如果未列出F列,此方法将起作用

=IF(F1="","YES",IF(E1>F1,"YES","NO")) - Performs a similar check but for the set value "" which is a formulated forced blank cell =IF(F1="","YES",IF(E1>F1,"YES","NO")) -执行类似的检查,但对设定值""进行说明,该值是公式化的强制空白单元格

=IF(ISNUMBER(F1),IF(E1>F1,"YES","NO"),"YES") - Sense check for if the cell is a number (In case the formulated column is a numerical calculation) =IF(ISNUMBER(F1),IF(E1>F1,"YES","NO"),"YES") -合理检查单元格是否为数字(如果公式化的列为数值计算)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM