XL Help: Value_If_True Argument in IF Function Is Not Optional
ID: Q179086
|
The information in this article applies to:
-
Microsoft Excel for Windows, versions 5.0, 5.0c
-
Microsoft Excel for Windows 95, versions 7.0, 7.0a
-
Microsoft Excel 97 for Windows
-
Microsoft Excel for the Macintosh, versions 5.0, 5.0a
-
Microsoft Excel 98 Macintosh Edition
SYMPTOMS
If you enter a formula that uses the IF worksheet function, you may
receive one of the following error messages:
Error in formula.
-or-
The formula you typed contains an error.
CAUSE
This problem occurs if you completely omit the value_if_true argument in
the IF worksheet function, as in the following example:
=IF(A1=0)
The Help topic for the IF worksheet function indicates that the
value_if_true argument is optional; however, the argument is actually
required.
RESOLUTION
To prevent this problem from occurring, make sure that you include at
least a comma (,) after the logical_test argument in the IF function. For
example, this formula will be accepted by Microsoft Excel:
=IF(A1=0,)
If possible, you should actually include valid value_if_true and/or
value_if_false arguments, as in the following examples:
Both arguments included
-----------------------
=IF(A1=0,"A1 is zero.","Al is not zero.")
Value_if_false argument omitted
-------------------------------
=IF(A1=0,"A1 is zero.")
Value_if_true argument omitted
------------------------------
=IF(A1=0,,"A1 is not zero.")
MORE INFORMATION
In the versions of Microsoft Excel listed at the beginning of this
article, the Help topic for the IF worksheet function states the
following:
IF(logical_test,value_if_true,value_if_false)
Logical_test is any value or expression that can be evaluated to TRUE
or FALSE.
Value_if_true is the value that is returned if logical_test is TRUE.
If logical_test is TRUE and value_if_true is omitted, TRUE is
returned. Value_if_true can be another formula.
Value_if_false is the value that is returned if logical_test is FALSE.
If logical_test is FALSE and value_if_false is omitted, FALSE is
returned. Value_if_false can be another formula.
The above information contains the following problems:
- The second paragraph ("Value_if_true") is partially incorrect. If
logical_test is TRUE and value_if_true is omitted, the IF function
returns zero (0).
- The third paragraph ("Value_if_false") is also partially incorrect. If
logical_test is FALSE and value_if_false is omitted, the IF function
returns zero (0).
- If you completely omit the value_if_true argument by not including a
comma after the logical_test argument, the formula will not be
accepted by Microsoft Excel, and you will receive one of the error
messages mentioned in the "Symptoms" section.
Note that this problem in the IF function Help topic does not occur in
Microsoft Excel versions 4.0 and earlier.
Additional query words:
XL5 XL7 XL97
Keywords : kbdocerr xlhelp
Version : MACINTOSH:5.0,5.0a; WINDOWS:5.0,5.0c,7.0,7.0a,97
Platform : MACINTOSH WINDOWS
Issue type : kbinfo