Consider the following MS-EXCEL function entered in cell C1: =IF(A1>B1, 1,…
2024
Consider the following MS-EXCEL function entered in cell C1:
=IF(A1>B1, 1, IF(A1=10, 2, IF(A1<B1, 3, 4)))
The above function will return a value of 4 in cell C1 if the values in cell A1 and cell B1 are ______ respectively.
Answer: C. 11 and 11 — Concept — A nested IF is evaluated from the outside in. IF(logical_test, value_if_true, value_if_false) returns value_if_true the moment its test is TRUE, and…
- A.
11 and 10
- B.
9 and 10
- C.
11 and 11
- D.
10 and 10
Attempted by 1 students.
Show answer & explanation
Correct answer: C
Concept — A nested IF is evaluated from the outside in. IF(logical_test, value_if_true, value_if_false) returns value_if_true the moment its test is TRUE, and moves into the value_if_false slot only when the test is FALSE. In a nested chain that slot holds the next IF, so the last value_if_false is the fallback: it is returned only when every test in the chain has evaluated to FALSE.
Application — In this formula the fallback value is 4, so all three tests must be FALSE at the same time:
A1>B1 must be FALSE, so the number in A1 is not greater than the number in B1.
A1<B1 must be FALSE, so the number in A1 is not smaller than the number in B1. Combined with the previous step, the only possibility left is A1 = B1.
A1=10 must be FALSE, so the number shared by the two cells must be something other than 10.
So the fallback is reached exactly when A1 and B1 hold the same number and that number is not 10.
Cross-check — Evaluating each offered pair against the chain of tests:
Values in A1 and B1 | First test that is TRUE | Value returned in C1 |
|---|---|---|
11 and 10 | A1>B1 | 1 |
9 and 10 | A1<B1 | 3 |
11 and 11 | none - all three tests are FALSE | 4 |
10 and 10 | A1=10 | 2 |
Result — Among the offered pairs, only 11 and 11 holds equal values that are not 10, so that is the pair for which cell C1 shows 4.