In This Topic

IF

In This Topic

This function performs a comparison and returns one of two provided values based on that comparison.

IF(*valueTest*,*valueTrue*,*valueFalse*)

This function has these arguments:

Argument | Description |
---|---|

valueTest |
Value or expression to evaluate |

valueTrue |
Value to return if the test evaluates to true |

valueFalse |
Value to return if the test evaluates to false |

The value of *valueTest* is evaluated. If it is non-zero (or TRUE), then *valueTrue* is returned. If it is zero (or FALSE), then *valueFalse* is returned. The value of *valueTest* must be or evaluate to numeric data, where non-zero values indicate TRUE, and a value of zero indicates FALSE. It may contain one of the relational operators: greater than (>), less than (<), equal to (=), or not equal to (<>).

Accepts numeric (boolean) data. Returns any data type.

IF(A3<>2000,1900,2000)

IF(R1C2>65,1000,2000)

IF(C4,B2,B4)

IF(1>2,5,10) gives the result 10

IF(1<2,""dogs"",""cats"") gives the result dogs

See Also