Use of IF function in Excel is done to evaluate a condition and returns value when condition is TRUE, and another value when condition is False.

**
**

## Syntax for use of IF statement

IF(condition to be evaluated , value if true, value if false])

Variables

Condition to be evaluated – value on which test is to be done

Value if True (optional) – This value is returned in case condition is true. This is optional i.e. if left blank will return zero.

Value if False (optional) – This value is returned in case condition is false. This is optional i.e. if left blank will return zero.

## Example of IF statement

### Use for numerical values

=IF(A1=1,TRUE,FALSE)

This formula will test A1 cell for value equal to 1. If it is equal to1 it will return true else it will return false. Other operators which can be used to test numerical values is greater than (>), less than(<), Not equal to(<>), greater than equal to(>=) and less than equal to(<=).

### Use for text values

=IF(A1=”test”,TRUE,FALSE)

This formula will test A1 cell for value test. If it contains test it will return true else it will return false

### Use IF function with Wildcard

Since if statement does not allow use of Wildcard directly

=IF(LEFT(A1,3)=”Tes”,TRUE,FALSE)

Use of LEFT with IF provides the wildcard effect. In above statement cell A1 is tested for **Tes**. It returns True or False as per cell value.