Forum Discussion
gen81465
Mar 09, 2021Copper Contributor
Possible error in IF function
While designing a spreadsheet in Excel 365, I was inputting an IF() function. Support documentation indicates that the [value_if_true] and [value_if_false] responses are optional. There is a problem ...
HansVogelaar
Mar 09, 2021MVP
If you omit value_if_true, the return value will NOT be TRUE if the condition is met. From IF function:
Common problems
Problem |
What went wrong |
---|---|
0 (zero) in cell |
There was no argument for either value_if_true or value_if_False arguments. To see the right value returned, add argument text to the two arguments, or add TRUE or FALSE to the argument. |
So you should always provide both value_if_true and value_if_false
- gen81465Mar 09, 2021Copper ContributorI agree that value_if_true and value_if_false should always be included, but they are listed by Microsoft Support as optional. Perhaps the IF() function should generate an error if either argument is left out.
- SergeiBaklanMar 09, 2021Diamond Contributor
Optional parameters quite often (not always) return zero. For example, =MAX(-1,) gives 0.
- HansVogelaarMar 09, 2021MVP
They are optional, but the result of =IF(condition, , ) will not be TRUE or FALSE, but 0, as you have found.
By the way, if you omit the second comma and if the condition is FALSE, the result will be FALSE:
=IF(4>5, "Yes") returns FALSE.