# IF

Returns the first value if logical_expression is TRUE; otherwise returns the second value.

## Syntax

```
IF(logical_expression, value_if_true, [value_if_false])
```

## Arguments

| Argument              | Description                                                                         | Required |
|----------------------|-------------------------------------------------------------------------------------|----------|
| `logical_expression` | A logical expression or a value that can be evaluated as TRUE or FALSE.            | Required |
| `value_if_true`     | The value to return if logical_expression evaluates to TRUE.                       | Required |
| `value_if_false`    | The value to return if logical_expression evaluates to FALSE.                      | Optional |

## Examples

### Simple true/false comparison

=IF(5 > 3, "Yes", "No")

Result ⇒Yes

### Check if cell value meets condition

=IF(A1 >= 90, "A", "B")

Result ⇒B

|     |     |
| --- | --- |
|  | A |
| 1 | 85 |

### IF with only two arguments (defaults to FALSE)

=IF(A1 > 200, "High")

Result ⇒false

|     |     |
| --- | --- |
|  | A |
| 1 | 100 |

## Related Functions

Other Logical functions:

- [AND](/content/docs/formulas/and.html) \- Returns true if all arguments evaluate to true
- [CONTAINS](/content/docs/formulas/contains.html) \- Returns true if a range contains a specified value
- [IFERROR](/content/docs/formulas/iferror.html) \- Returns a custom result when a formula generates an error, and a normal result when no error is detected.
- [IFS](/content/docs/formulas/ifs.html) \- Returns the value corresponding to the first TRUE result when evaluating multiple tests.
- [ISBETWEEN](/content/docs/formulas/isbetween.html) \- Returns true if a provided number is between two other numbers either inclusively or exclusively; otherwise returns false.
- [ISBLANK](/content/docs/formulas/isblank.html) \- Returns true if the value is blank, empty, or null; otherwise returns false.
- [ISERROR](/content/docs/formulas/iserror.html) \- Returns TRUE if the value is any error value
- [ISEVEN](/content/docs/formulas/iseven.html) \- Returns TRUE if the number is even, FALSE if odd
- [ISNA](/content/docs/formulas/isna.html) \- Returns TRUE if the value is the #N/A error value
- [ISNUMBER](/content/docs/formulas/isnumber.html) \- Returns TRUE if the value is a number
- [ISODD](/content/docs/formulas/isodd.html) \- Returns TRUE if the number is odd, FALSE if even
- [ISTEXT](/content/docs/formulas/istext.html) \- Returns TRUE if the value is text
- [NOT](/content/docs/formulas/not.html) \- Returns FALSE if logical expression is TRUE and TRUE if logical expression is FALSE.
- [OR](/content/docs/formulas/or.html) \- Returns true if any argument evaluates to true
- [SWITCH](/content/docs/formulas/switch.html) \- Evaluates an expression against a list of values and returns the result corresponding to the first matching value. Optionally returns a default value if no match is found.
- [XOR](/content/docs/formulas/xor.html) \- Returns TRUE if an odd number of arguments are TRUE, and FALSE otherwise
