Excel's workhorse: The If Statement
"How do I use the IF statement, and what if I have more than one condition?"
For those who do not know, an if statement is comprised of a condition, the result if that condition is true and the result if that condition is false.
=If(A1>10,"Bigger than ten","Smaller than ten")
Would return the words 'Bigger than ten' if Cell A1 were 11 for example and would return Smaller than ten, if Cell A1 were 8 for example.
But what if you have two or more conditions? A solution can be:
=If(A1>10,"Bigger than ten",If(A1>5,"Smaller than five", "Between ten and five")
You can do up to seven if statements.... but if you do now want to be constrained by 7 if statements, the AND function can be very useful:
=if(AND(A1<10,A1>5),"Smaller than 10 & bigger than 5","Not Smaller than 10 & bigger then 5")
The graph below shows a similar example for those who are financially inclined. If the Market value is below 120B and the Price to earnings ratio is less than 25, flag the stock as a buy, otherwise as a sell.


0 Comments:
Post a Comment
<< Home