How to use the IF function in Excel

The IF function in Excel checks for a true or false condition. If the condition is true, the function returns a value, if the condition fails the function returns another value

The IF function in Excel checks for a true or false condition. If the condition is true, the function returns a value, if the condition fails the function returns another value

The function usually has 3 arguments: the condition you want to check, the return value if the condition is true, and the value returned if the condition is false

The syntax of the IF function in Excel

IF (Test condition, value if condition is true, value if condition is wrong)

Test conditions

The test condition evaluates an expression to see whether it is TRUE (true) or FALSE (false).

Operator used to test

 

Value to check

Result

A = 10
B = 5 C = 15
D = 10

= (Degree)

A = B

FALSE (False)

A = D

TRUE (Right)

> (Larger)

A> B

TRUE (Right)

A> C

FALSE (False)

<(Smaller)

A

FALSE (False)

A

TRUE (Right)

> = (Greater than or equal to)

A> = B

TRUE (Right)

A> = D

TRUE (Right)

A> = C

FALSE (False)

<= (Less than or equal to)

A <= B

FALSE (False)

A <= C

TRUE (Right)

A <= D

TRUE (Right)

True condition value

The correct IF condition returns a value or operation. Whether it is a value or an operation, the result is returned in the cell containing the IF () function.

Incorrect condition value

The wrong IF condition will return a value or an operation and the result returned in the cell containing the IF () function.

Excel IF function example

To understand Excel's IF function, follow the following example

Follow the example of calculating bonuses based on all sales. A company pays salespeople 5% of the bonus if the price of the total sales is less than $ 5,000 per month, but if the price is over $ 5,000 per month, pay that employee 10% bonus.

Write IF () function:

IF (Total sales> 5000, Total sales * 10%, Total sales * 5%)

- Enter the following data for columns A and B

How to use the IF function in Excel Picture 1How to use the IF function in Excel Picture 1

- Type the IF () function into a cell. In this case, select cell C2

- From the Insert menu, click Function . , Insert Function dialog box is displayed

Or press the shortcut key combination Shift + F3

How to use the IF function in Excel Picture 2How to use the IF function in Excel Picture 2

- From the Insert Function dialog box, select the IF function and click OK. The Function Argumens dialog box is displayed

How to use the IF function in Excel Picture 3How to use the IF function in Excel Picture 3

- In Logical_test , enter B2> 5000 . Press Tab

- In Value_if_true , enter 10% . Press Tab

- In Value_if_false section, enter 5% . Click OK .

- The cells C3 to C6 are executed like cell C2

Note : Any time you change data from column B2 to B6, the bonus portion of the employee is automatically calculated.

See also: How to use Vlookup function in Excel

5 ★ | 1 Vote