Hi Onil ,
The Excel help should explain everything. Let me try.
The syntax of the IF statement is :
=IF( check a condition , output a result if the check is TRUE , output a result if the check is FALSE )
check a condition :
This is to be framed as just a cell reference , or an expression which can be evaluated.
A cell reference would be for example J17 , as in :
=IF( J17 , 10 , 5 )
Try this formula with various values in J17 ; enter values such as :
a. negative values
b. 0
c. positive values
d. text values
An expression would be :
=IF( J17 >= 13 , "Teenager" , "Child" )
Again try this formula with the different values indicated above.
The expression can be quite complicated , and include other Excel functions , including another IF statement !
output a result if the check is TRUE :
This can be a literal value , or a cell reference , or an expression which can be evaluated.
If you enter an expression such as 5500/30*A1 , Excel evaluates it using the contents of cell A1 , and returns an arithmetic result.
The same happens with your initial formula , where this expression was :
B1 = 5500/30*A1
But the evaluation in our expectation is different from the evaluation as carried out by Excel !
As far as Excel is concerned , this is an equation ; to evaluate it , the left hand side and the right hand side are evaluated separately , and then compared to see whether they are equal.
If this formula is entered in any cell other than A1 and B1 , there is no problem ; Excel will see what cell B1 contains . what cell A1 contains , evaluate the two sides separately , compare them , and then return a TRUE or FALSE result ; a TRUE result would mean that both sides are equal , a FALSE result would mean that they are unequal.
If this formula is entered in B1 itself , then you are creating what is called a circular reference , and Excel will display a message to this effect. You will need to correct either the formula or the Excel options which will then permit such a formula to be entered and evaluated correctly.
output a result if the check is FALSE :
The above description applies to this section also , except that this section is executed only when the condition is FALSE.
Narayan