Description
Use this function to perform a logical test and return one value for a TRUE result, and a different one for a FALSE result. Supported in Chains. Can be used with CHILDREFS.
IF allows you to make logical comparisons between a value and what you expect.
Syntax
IF(logical_test, value_if_true, [value_if_false])
Inputs
This function accepts the following arguments:
| Name | Required | Description | Valid input |
|---|---|---|---|
logical_test |
Yes | The condition you want to test. | Any value or expression that can be evaluated to TRUE or FALSE. |
value_if_true |
Yes | The value to return if logical_test is TRUE. |
A cell reference, a cell range, a number, a text string, or a formula which results in any of these. A hard-coded value is also acceptable. |
value_if_false |
No | The value to return if logical_test is FALSE. |
A cell reference, a cell range, a number, a text string, or a formula which results in any of these. A hard-coded value is also acceptable. If omitted, FALSE is returned. |
Examples
Sample data
| A | B | |
|---|---|---|
| 1 | 75 | Pass |
| 2 | 60 | Fail |
| 3 | 85 | Pass |
| 4 | 45 | Fail |
Sample formulas
| Use case | Formula | Explanation and Result |
|---|---|---|
| Return one value if the value in the identified cell is greater than the supplied value, otherwise return another value. | =IF(A1>=70,"Pass","Fail") |
This formula works in the following manner:
For this data set this formula returns Pass. |
| Return the value of one cell if the value in another cell is greater than the supplied value, otherwise return the supplied text. | =IF(A2>50,B2,"Low Score") |
This formula works in the following manner:
For this data set this formula returns Fail. |
| Return specified results based on the score in the supplied cell. | =IF(A3=85,"Excellent",IF(A3>=70,"Good","Needs Improvement")) |
This formula works in the following manner:
For this data set this formula returns Excellent. |
| Return letter grades based on the score using multiple nested IF functions. | =IF(A4>90,"A",IF(A4>80,"B",IF(A4>70,"C",IF(A4>60,"D","F")))) |
This formula works in the following manner:
For this data set this formula returns F. |
Notes
- The IF function can be nested up to 64 levels deep.
- If the
value_if_falseargument is omitted, IF returns FALSE when the condition is not met. - The
logical_testargument can use any comparison operator (=, <>, <, >, <=, >=). - You can combine IF with the AND, OR, and NOT functions within the logical_test argument to create more complex conditions.
- You can combine IF with other functions such as ISBLANK, ISNUMBER, etc., for more advanced logical tests.
Tips
- For multiple conditions, consider using the IFS function (available in Excel 2016 and later) instead of nested IF statements.
- Use the IFERROR function to handle potential errors in your IF statements.
- When working with text in IF functions, remember that Workiva spreadsheets are not case-sensitive by default.
- To test for multiple conditions, you can use the AND or OR functions within the
logical_testargument. - For complex scenarios with many conditions, consider using a VLOOKUP or INDEX/MATCH combination instead of multiple nested IFs.