Q:  What is a nested “if” statement?
A: A nested “if” statement is the true condition in a series of conditions in computer programming. It is used when multiple responses are possible and the outcome for each response is different.

As Per My Knowledge Answers is:
A: IF with in the IF is called “Nested IF“.

Syntax : if(condition,doiftrue,doiffalse)
Nested If Syntax :  if(condition,doiftrue, if(condition,doiftrue,doiffalse))
IF with in the IF.

In the example shown, we are using nested IF functions to assign grades based on a score. The logic for assigning a grade goes like this:
Score
Grade
0-63
F
64-72
D
73-84
C
85-94
B
95-100
A
To build up a nested IF formula that reflects this logic, we can start by testing to see if the score is below 64. If TRUE, we return “F”. If FALSE, we move into the next IF function. This time, we test to see if the score is less than 73. If TRUE, we return “D”. If FALSE, we move into yet another IF function. And so on.
Eventually, the formula we have in cell D5 looks like this:
=IF(C5<64,"F",IF(C5<73,"D",IF(C5<85,"C",IF(C5<95,"B","A"))))

You can see that it's important in this case to move in one direction, either low to
high, or high to low. This allows us to return a result whenever a test returns TRUE,
 because we know that the previous tests have returned FALSE.

Other Example:

if("MARKS_PERCENTAGE">=60,'FIRST CLASS',if("MARKS_PERCENTAGE">=50 and "MARKS_PERCENTAGE"<60,
'SECOND CLASS',if("MARKS_PERCENTAGE"<50,'THIRD CLASS','FAIL')))

Explanation: If MARKS_PERCENTAGE is grater then 60 it will display First class other wise It go to next
If condition.


Comments

Popular posts from this blog

Creation of dynamic filters in SAP HANA Schema

How To Use Decision Table In Calculation View In SAP HANA