Site icon libreofficehelp.com

IF Function in LibreOffice Calc – Basics and Examples

The IF function is a powerful in-cell function in LibreOffice or OpenOffice Calc.

And you can do anything literally with it if you know the basics. Here’s how.

The basics are very simple. The IF function uses conditions to determine results.  If the condition is met, then one result is shown, and if the condition is not met, then another result is shown.

Here are some examples to help you understand.

IF Syntax

IF(Test, Then Value, Otherwise Value)

Simple IF Function examples

The below example checks whether the price is greater than $500, and based on that, we fill in High or Low in the adjacent cells.

=IF(A2>500,"High","Low")
Simple IF function – example 1

The below example also gives the exact result. Note that the operator is changed to less than sign (<) and arguments have been swapped.

=IF(A2<500,"Low","High")

IF function usage notes

IF example, with String

Nested IF examples

You can combine multiple IF statements for multiple conditions in a Calc cell. The FALSE or the third operator of the IF statement is replaced by another IF statement to evaluate another test or condition.

In the below example, if the score is 50, ‘Good’ is shown. If it is 100, then excellent; otherwise, it is invalid. You can note that all three possible tests are added in the single cell with two nested IF statements.

=IF(B2=50,"Good",IF(B2=100,"Excellent","Invalid"))
Nested IF example

Conclusion

This is the most simple way to work in a Calc spreadsheet with conditions using IF. You can refer to the official guide here.

Drop a comment below if you have any questions.

Exit mobile version