Is it possible to test a cell using IF
against multiple strings? So for example, I want the function to output Fruit
in cell A2 if cell A1 contains the string Apple
or Orange
. I can only come up with this in cell A2:
IF(A1 = "Apple"|"Orange", "Fruit", "Not a fruit")
This results in an error.
Best Answer
This is thankfully quite easy. You can achieve what you want using the
OR
function in Numbers (this function is also found on Microsoft Excel):The argument for the
IF
function here isOR(A1 = "Apple", A1 = "Orange")
. ThisOR
function tests whether any of the arguments are correct; if they are, it returnsTRUE
. If none of them are correct, it returnsFALSE
.