Xenase,
The if() function actually takes three arguments:
IF(if-expression, if-true, if-false)
- if-expression: A logical expression. if-expression can contain anything as long as the expression can be evaluated as a boolean value. If the expression evaluates to a number, 0 is considered to be FALSE, and any other number is considered to be TRUE.
- if-true: The value returned if if-expression is TRUE. if-true can containany value. If if-true is omitted (there’s a comma, but no value) and if-expressionevaluates to TRUE, IF will return 0.
- if-false: An optional argument specifying the value returned if if-expression is FALSE. if-false can contain any value. If if-false is omitted (there’s a comma, but no value) and if-expressionevaluates to FALSE, IF will return 0. If if-false is entirely omitted (there’s no comma after if-true) and if-expressionevaluates to FALSE, IF will return FALSE.
you are leaving the if-false portion blank.
so if you want nothing when the boolean test is false you should enter the empty string for the third argument like:
=if(A1>A2, 3, "")
or
=if(B1=B2, 1, "")
if you do not want any result when either cell is blank you can perform the test:
=if(or(isblank(B1), isblank(B2)), "", if(B1=B2, 1, ""))