libreofficehelp.com

Quick Tutorials, Solutions and to the point.

Calc Calc-Basics

IF Function in LibreOffice Calc – Basics and Examples

IF function is one of the powerful in-cell function in LibreOffice Calc. And you can do literally anything with it, if you know the basics. Here’s how.

The basic is very simple. 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

Below example checks whether the price is greater than $500 and based on that we fill High or Low in adjacent cell.

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

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

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

Note:
You can use any comparison operators e.g. = (equal to), > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to) and <> (not equal to) in IF formula.

SEE ALSO:  How to Freeze and Unfreeze Rows columns and ranges in Calc

You can also use text/strings in IF statements with comparison operators. Remember to enclose the text or string using double quotes (“).

Below example checks whether each cell contains ‘Mango’ then it returns ‘Fruit’ in adjacent cell.

IF example with String
IF example with String

Nested IF

You can combine multiple IF statements for multiple conditions in Calc cell. The FALSE or the third operator of 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 Invalid. You can note that all three possible test 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 Calc spreadsheet with conditions using IF. You can refer the official guide here.

Drop a comment below, if you have any questions.

SEE ALSO:  LibreOffice Calc - Supported File Formats


For the latest tutorials, app reviews and how-to guides, follow libreofficehelp.com on Twitter, Facebook, and subscribe to our YouTube channel and email updates via below form.

Join 510 other subscribers.