IF Function: Difference between revisions
From Planfix
No edit summary |
No edit summary |
||
(20 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{#seo: | |||
|title=IF Function | |||
|titlemode=append | |||
|keywords=planfix, function, IF, if | |||
|description=IF Function | |||
}} | |||
This function returns one of two values, depending on a condition. | This function returns one of two values, depending on a condition. | ||
Line 4: | Line 10: | ||
''Format:'' | ''Format:'' | ||
*'''IF(condition;yes_value;no_value)''' | |||
''where:'' | ''where:'' | ||
Line 20: | Line 23: | ||
''Examples:'' | ''Examples:'' | ||
IF(D="Text in column";"Good";"Bad") | |||
IF(D > 100500;"A lot";"A little") | |||
IF([[CONTAIN Function|CONTAIN]](H;"Qualification");G;"") | |||
''Notes:'' | ''Notes:'' | ||
Line 35: | Line 38: | ||
Line 62: | Line 52: | ||
*Line breaks cannot be used in formulas or when generating documents. | *Line breaks cannot be used in formulas or when generating documents. | ||
''Example:'' | |||
Depending on whether or not there is a number in column D, either return either that number or the number in column E: | |||
https://pic.planfix.ru/pf/sQ/b9JZU3.png | |||
Latest revision as of 13:48, 8 May 2024
This function returns one of two values, depending on a condition.
Format:
- IF(condition;yes_value;no_value)
where:
- condition - logical expression using the symbols >, <, =, >=, <=, !=, another function or value
- yes_value - number or string that the function returns if the condition is met
- no_value - number or string that the function returns if the condition is not met
Examples:
IF(D="Text in column";"Good";"Bad")
IF(D > 100500;"A lot";"A little")
IF(CONTAIN(H;"Qualification");G;"")
Notes:
- the condition can be an arithmetic expression. If the result of this expression is a non-zero number, then the condition is considered to be fulfilled. If the result of the expression is zero, then the condition is considered not fulfilled
- the values can be expressions that use data from report columns or variables in calculated fields
- use a "Yes"/"No" test to check a Checkbox custom field in a data tag or data tag calculated field. In other cases, without data tags, use a 1/0 check.
Particularities of working with formulas and functions
Please note the following:
- All arguments of the IF formula must be included (Condition;Action_IF_YES;Action_IF_NO);
- Nesting IF inside IFs is not limited, but the number of arguments must be correct;
- Empty NUMBER fields equal zero, and nothing more;
- Empty STRING fields and other fields (or not all) are entered as empty quotes: "";
- You can multiply by "-1";
- Line breaks cannot be used in formulas or when generating documents.
Example:
Depending on whether or not there is a number in column D, either return either that number or the number in column E: