IF function


If-then-else function. IF(condition,x,y) returns x if the condition is TRUE (=1), but returns y if the condition is FALSE (=0).

This function is also useful for conversion of continuous data into discrete data.


IF(C2<0,"NEG","POS") returns the string value "NEG" if the number in cell C2 is less than 0 (C2<0 = TRUE). If cell C2 contains a number equal to or more than 0, then this function returns the string value "POS".

IF(A1>1,25,33) returns 25 if cell A1 contains a value greater than 1. If A1 contains 1 or a value less than 1, then this expression returns 33.

IF(RESULT="pos",1,0) returns 1 when the variable RESULT contains the string value "pos", and returns 0 if not.



Related functions

Privacy & cookies Contact Site map