Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use OR in LibreOffice calc IF statement?

I'm trying to achieve something like:

=IF( N2="string1", "high", IF( N2="string2" or N2="string3","middle","low") )

Or, in psuedo code:

String input = <some value>
if( input.equals("string1") ) {
     return "high"
} else if ( input.equals("string2) || input.equals("string3") ) {
    return "middle"
} 
return "low"

Any idea how I can do that using a spreadsheet (Libre Office Calc ideally) formula rather than code? Where the input variable would obviously be a cell reference.

like image 339
DaFoot Avatar asked Nov 11 '14 18:11

DaFoot


People also ask

Is LibreOffice Calc as good as Excel?

LibreOffice has 1440 reviews and a rating of 4.32 / 5 stars vs Microsoft Excel which has 17280 reviews and a rating of 4.77 / 5 stars. Compare the similarities and differences between software options with real user reviews focused on features, ease of use, customer service, and value for money.

What is the purpose of IF function in Calc explain with example?

Syntax. Use the IF function, one of the logical functions, to return one value if a condition is true and another value if it's false. For example: =IF(A2>B2,"Over Budget","OK")


1 Answers

Using your example of "N2" as the cell reference, the formula would be the following:
=IF( N2="string1", "high", IF( OR(N2="string2",N2="string3"),"middle","low") )
If you would like to read up on the "OR" Function in Libre Office, you can click here.
Please let me know if that doesn't work.

like image 179
Aterxerxes Avatar answered Oct 12 '22 00:10

Aterxerxes