Can I use OR in LibreOffice calc IF statement?

21,311

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.

Share:
21,311

Related videos on Youtube

DaFoot
Author by

DaFoot

Professional Java & Angular developer Hobbyist photographer Train in Judo (competitor / coach / referee) Buy me a coffee (or a beer!): https://www.buymeacoffee.com/dafoot

Updated on July 09, 2022

Comments

  • DaFoot
    DaFoot almost 2 years

    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.

    • DaFoot
      DaFoot
      Guess it must be that. Though how you find the or() function when you don't know it exists isn't easy if expecting OR to be an operator. Try searching for if with or. ;)