Difference between revisions of "Documentation/How Tos/Calc: IF function"
From Apache OpenOffice Wiki
< Documentation | How Tos
m |
m |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | __NOTOC__ | + | {{DISPLAYTITLE:IF function}} |
+ | {{Documentation/CalcFunc LogicalTOC | ||
+ | |ShowPrevNext=block | ||
+ | |PrevPage=Documentation/How_Tos/Calc:_FALSE_function | ||
+ | |NextPage=Documentation/How_Tos/Calc:_NOT_function | ||
+ | }}__NOTOC__ | ||
== IF == | == IF == | ||
Line 15: | Line 20: | ||
=== Example: === | === Example: === | ||
− | <tt>'''IF(A1>5;100;"too small")'''</tt> | + | <tt>'''IF(A1>5; 100; "too small")'''</tt> |
: returns the number 100 if A1 is greater than 5, and the text "too small" otherwise. | : returns the number 100 if A1 is greater than 5, and the text "too small" otherwise. | ||
− | <tt>'''IF(1>2;"nonsense")'''</tt> | + | <tt>'''IF(1>2; "nonsense")'''</tt> |
: returns <tt>'''FALSE'''</tt> - because <tt>'''value2'''</tt> has been omitted and 1 is not greater than 2. | : returns <tt>'''FALSE'''</tt> - because <tt>'''value2'''</tt> has been omitted and 1 is not greater than 2. | ||
<tt>'''IF(2>1)'''</tt> | <tt>'''IF(2>1)'''</tt> | ||
: returns <tt>'''TRUE'''</tt> - because both <tt>'''value1'''</tt> and <tt>'''value2'''</tt> have been omitted and 2 is more than 1. | : returns <tt>'''TRUE'''</tt> - because both <tt>'''value1'''</tt> and <tt>'''value2'''</tt> have been omitted and 2 is more than 1. | ||
+ | <tt>'''IF(1=2; 1/0; SQRT(4))'''</tt> | ||
+ | : returns <tt>'''2'''</tt>, the square root of <tt>'''4'''</tt>. <tt>'''IF()'''</tt> only calculates the value chosen - in this case <tt>'''1/0'''</tt> would give an error #DIV/0!, but is not calculated. | ||
− | + | {{SeeAlso|EN| | |
− | + | * [[Documentation/How_Tos/Calc: COUNTIF function|COUNTIF]] | |
− | + | * [[Documentation/How_Tos/Calc: SUMIF function|SUMIF]] | |
− | + | * [[Documentation/How_Tos/Calc: Logical functions|Logical functions]] | |
+ | |||
+ | * [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]] | ||
+ | * [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}} | ||
+ | [[Category: Documentation/Reference/Calc/Logical functions]] |