简体   繁体   中英

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

How do I make the IF function consider blank cells as "0".

Here is the formula I am using in the H column cells: IF(E1>F1,"YES","NO")

Here is the specific Example:

E | F |G | H |

10 | 0 |30 | YES |

10 | 5 |10 | YES |

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

H3 should return "YES" I would think.

In this scenario I cannot change the blank cells to "0", they have to remain blank.

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".

The excel handles automatically for blank cells .

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(F1="","YES",IF(E1>F1,"YES","NO")) - Performs a similar check but for the set value "" which is a formulated forced blank cell

=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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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