# Use

The IF function checks whether a specified condition is met or not

# Description

The IF function is a logical function, where you first set a logical condition to test, for example, you may set a condition that; If 50 is equal to a cell A1’s value in worksheet then show “Right” otherwise “Wrong”. The IF function can also use with other logical functions like OR and AND.

# Syntax

=IF (logical_test, [value_if_true], [value_if_false])

logical_test – The logical condition set by user to evaluate as TRUE or FALSE.

[value_if_true] – The options argument use to specify a value when the logical_test evaluates to TRUE.

[value_if_false]) – The options argument use to specify a value when the logical_test evaluates to FALSE.

# Examples

### Check for empty cells

Formula:

Results:

### Highlight undelivered inventory

The IF function returns “Yes” for delivered products and “No” for in transit and ready to deliver products.

### Nested IF statement

Simple IF function only has two results (True or False) whereas by using nested IF functions 3 to 64 results are available.

Formula:

Results:

### Use of IF function with AND function

# Common problems

#NAME? occurs if the formula is misspelled, for example in above screenshot, if you write Category 1 in the function instead of “Category 1” then Excel will show #NAME? error.