Using Nested IF Function in MS Excel.
Hi friends, previously we have discussed about the IF function in MS Excel. And now, we will discuss about the Nested IF Function. This function is used when taking the decision against more than one condition. Where these conditions require to select more than one value to be returned.
Syntax.
The general syntax of Nested IF Functions.
IF(logical_test_1, value_if_true_1, IF(logical_test_2, value_if_true_2, value_if_false_2 ))
- logical_test_1 : a condition of a cell that you want to test.
- logical_test_2 : a condition of another cell if logical_test_1 returns FALSE.
- value_if_true_1 : a value that returned if a condition of logical_test_1 evaluated to TRUE
- value_if_true_2 : a value that returned if a condition of logical_test_1 evaluated to FALSE but
logical_test_2 evaluated to TRUE. - value_if_false_2 : a value that returned if all conditions evaluated to FALSE.
Look at these spreadsheets below.
- logical_test_1 sets to A1=10.
- logical_test_2 sets to A2=20.
- value_if_true_1 sets to "TEN".
- value_if_true_2 sets to "TWENTY".
- value_if_false_2 sets to "WRONG ANSWER".
Based on these spreadsheet, some explanations may be taken as follows.
=IF(A1=10,"TEN",IF(A2=20,"TWENTY","WRONG ANSWER"))
- If cell A1 equals to 10, D1 cell will returns the "TEN" value.
- But if cell A1 is not equal to 10, THEN cell D1 will evaluate the condition of cell A2, it applies because cell A1 condition was evaluated to FALSE.
- If cell A2 equals to 20, then cell D1 returns the "TWENTY" value.
- Otherwise, if cell A1 is not equal to 10 and cell A2 is not equal to 20, THEN all the conditions are evaluated to FALSE. And that means the returned value is "WRONG ANSWER".
0 Komentar untuk "Using Nested IF Function in MS Excel"