If Functions with Three Conditions – Nested If Statement

If Functions with Three Conditions – Nested If Statement

The IF Function with single condition

IF Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.

Use IF to conduct tests on values and formulas.

Syntax

IF(logical_test,value_if_false)

Logical test is any value or expression that can be evaluated to TRUE or FALSE. For example, A10=100 is a logical expression: if the value in cell A10 is equal to 100, the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.

Arguments:

1. Value_if_true is the value that is returned if logical test is TRUE.

2. Value_if_false is the value that is returned if logical test is FALSE.

Example: Create the following worksheet.

Calculate the total cost paid by each customer given the condition that for the customer who bought 500 cartons and above they were charged 450 per carton others were charged 500. Find the total cost.

Click ok and Autofill the formula to the rest of the cells

NESTED IF STATEMENTS

Nested IF statement is an IF statement within another IF statement. You can write an IF statement with as many outcomes as you want.

Syntax

=IF(CONDITION X, OUTPUT B, IF(CONDITION Y, OUTPUT C, OUTPUT D)))

In this structure, we have three outcomes with two conditions

We test IF condition X is false, we return output B

But if condition X is true, then we test condition Y

If condition Y is true, you have an output C and if it is false, you have output D

Example: Three conditions and four outcomes

Using the (Nested IF Formula) find the Grade on condition that;-

Average

Grade

>=70

DISTINCTION

>=60

CREDIT

>=50

PASS

<50

FAIL

Type the first if statement

Put a comma, and type the next condition

Type another condition, value_if_true and value_if_false.

=IF(E2>=70,”DISTINCTION”,IF(E2>=60,”CREDIT”,IF(E2>50,”PASS”,”FAIL”)))

Use the Autofill option to copy the formula to the rest of the cells