IF Statement with Four Outcomes

IF Statement with Four Outcomes

IF statement Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. An if statement with four outcomes requires you to test three conditions

The excel If () function is used to test a single condition which returns a value if the condition is met otherwise it will return the other value.

Structure of a single condition if statement

Four Outcomes screenshot

Syntax

IF(logical_test, value_if_true, value_if_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.

Structure of If statement with three conditions and four outcomes.

Four Outcomes screenshot

Syntax

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

In this structure, we have four outcomes with three conditions

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

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

If condition Y is true, you have an output C and if it is false, we test condition Z

If condition z is true we return output D, otherwise, we return output E.

Example: Three conditions and four outcomes

Four Outcomes screenshot

Find the Grade of the student given the 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 until the last condition is tested.

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

Four Outcomes screenshot

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

Four Outcomes screenshot