Contact

IF Function (OpenOffice Calc)

Logical Intermediate OpenOffice Calc

Learn the IF function in Apache OpenOffice Calc: Specifies a logical test to be performed.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Availability and version history

  • Introduced: Documented by Apache OpenOffice 4.1.16; original introduction not established.
  • Availability: Supported in Apache OpenOffice 4.1.16, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

IF chooses an outcome according to a logical test. A true test selects the second argument and a false test selects the third. It can return text, numbers or calculated values. It is a decision function, not an automatic rule for concealing every error in the workbook.

Syntax and arguments

=IF(test; value_if_true; value_if_false)
=IF(test; value_if_true)
=IF(test)

Test is required. If the false outcome is omitted, a false test returns logical FALSE. If both outcomes are omitted, the corresponding TRUE or FALSE is returned. These documented trailing omissions are distinct from an explicitly supplied empty text string or a missing placeholder between separators. Provide both outcomes when their types and meanings should be explicit. Examples use English function names and semicolon separators.

Worked example

=IF(2>1;"Yes";"No")

Expected result: Yes.

Why it works: Return a different value for TRUE and FALSE outcomes.

Example evidence

This original example retains its historical comparable LibreOffice 25.2 checking scope; it was not an OpenOffice native test. The reference controls below are independently checked source/documentation expectations, not new application captures.

Additional reference controls

Formula Reference result
=IF(2>1;"Yes";"No") "Yes"
=IF(2<1;"Yes";"No") "No"
=IF(1>2;99) FALSE
=IF(2>1) TRUE
=IF(1>2) FALSE
=IF(1=2;1/0;2) 2
=IF(2=2;1/0;2) ERROR

Quoted results are text. ERROR means the source’s error path without claiming a newly observed localized error message. Range formulas here use ordinary scalar entry unless the array form is explicitly discussed.

Practical worksheet

Enter scores 49,50,75 in A2:A4. In B2 enter =IF(A2>=50;"Pass";"Review") and fill down. The labels are Review,Pass,Pass; equality at 50 belongs to the passing side. In C2 enter =IF(A2>=50;1;0) and fill down. Indicators are 0,1,1 and their sum is 2.

This rule classifies the supplied numbers only. If valid scores must lie between 0 and 100, check that separately; the test A2>=50 would also pass 150. A condition should express the actual policy rather than relying on plausible-looking sample data.

Advanced applications and distinctions

Guard a division deliberately. With numerators 10,10,10 in D2:D4 and denominators 2,0,-2 in E2:E4, enter =IF(E2=0;"No ratio";D2/E2) in F2 and fill down. Expected outcomes are 5,No ratio,-5. The scalar interpreter follows the selected branch, so the zero row does not require evaluating its unselected division.

Order nested thresholds. =IF(A2>=80;"High";IF(A2>=50;"Medium";"Low")) maps scores 49,50,79,80 to Low,Medium,Medium,High. Check the highest boundary first in this arrangement. Reversing the tests would cause values at least 80 to be captured by the broader 50 test.

Choose output types intentionally. =IF(A2>=50;1;0) creates a numeric indicator, whereas replacing 1 and 0 with quoted strings creates text labels. An empty string "" is also text, not a physically empty cell. Downstream counts, comparisons and exports can distinguish those states.

Errors and troubleshooting

An error in the test is not a valid false condition and should not be interpreted as a failed score. A selected result expression can also fail. IF protects only through a condition that actually prevents the invalid calculation; writing an unrelated condition does not make the result safe.

The official reference and scalar jump code support selected-branch calculation. Array paths, volatile formulas and recalculation of separately referenced cells have their own rules, so this is not a blanket performance guarantee for a complex workbook. Test the intended workbook when lazy evaluation matters operationally.

Quote literal text but leave real references and calculations unquoted. Use semicolons in the shown English Calc formulas. Numeric and text comparisons are not interchangeable validation strategies, and locale-dependent parsing of imported fields can change their types. The examples use explicit numeric scores and explicit comparisons rather than assuming arbitrary text is a Boolean. First introduction and final functioning release are separate from the documented release support retained above.

Documentation and verification

The official IF function reference was retrieved October 15, 2026. The pinned 4.1.16 interpreter and function descriptions retain their October 13 source retrieval dates. These support scalar branch selection, reference dimensions, lookup modes and the limitations stated here. Original introduction and last functioning version remain unestablished, separate from documented release support. No new native, GUI, array-entry or import/export test was performed.