IF function
From Apache OpenOffice Wiki
< Documentation | How Tos
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
< {{#switch:Previous Page | Previous Section = Previous Section | Next Section = Next Section | Previous Page = Previous Page | Next Page = Next Page | }} | {{#switch:Next Page | Previous Section = Previous Section | Next Section = Next Section | Previous Page = Previous Page | Next Page = Next Page | }} > |
IF
Returns one of two values, depending on a test condition.
Syntax:
IF(test; value1; value2) where:
- test is or refers to a logical value or expression that returns a logical value (TRUE or FALSE).
- value1 is the value that is returned by the function if test yields TRUE.
- value2 is the value that is returned by the function if test yields FALSE.
If value2 is omitted it is assumed to be FALSE; if value1 is also omitted it is assumed to be TRUE.
Example:
IF(A1>5; 100; "too small")
- returns the number 100 if A1 is greater than 5, and the text "too small" otherwise.
IF(1>2; "nonsense")
- returns FALSE - because value2 has been omitted and 1 is not greater than 2.
IF(2>1)
- returns TRUE - because both value1 and value2 have been omitted and 2 is more than 1.
IF(1=2; 1/0; SQRT(4))
- returns 2, the square root of 4. IF() only calculates the value chosen - in this case 1/0 would give an error #DIV/0!, but is not calculated.
{{#switch:EN
| RU = Смотрите также:
| UA = Дивіться також:
| EN = See Also
| PT = Ver também
| #default = See Also
}}