# IF

Spread for WinForms provides advanced software components that support Excel import/export, full cell customization, an extensive calculation engine with over 450 functions and more, all with zero dependencies on Excel.

## Content



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

## Syntax

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

## Arguments

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 |

## Remarks

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 (<>).

## Data Types

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

## Example

`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

## Version Available

This function is available in product version 1.0 or later.

## See Also

[AND](/spreadnet/docs/latest/online-formula/formulas-functionsall/formulas-functsAtoC/FunctionAND) \| [FALSE](/spreadnet/docs/latest/online-formula/formulas-functionsall/formulas-functsDtoG/FunctionFALSE) \| [Logical Functions](/spreadnet/docs/latest/online-formula/formulas-overview/formulas-functs/formulas-functtypes/formulas-functslogic)