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 11Concept — 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…

  1. A.

    11 and 10

  2. B.

    9 and 10

  3. C.

    11 and 11

  4. D.

    10 and 10

Attempted by 1 students.

Show answer & explanation

Correct answer: C

ConceptA 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.

ApplicationIn this formula the fallback value is 4, so all three tests must be FALSE at the same time:

  1. A1>B1 must be FALSE, so the number in A1 is not greater than the number in B1.

  2. 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.

  3. 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-checkEvaluating 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

ResultAmong 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.

Explore the full course: Nta Ugc Net Paper 1

Loading lesson…