If statements
-
Upload
best-language -
Category
Education
-
view
239 -
download
0
description
Transcript of If statements
Click to continue
It answers the question, “Is this true or false?”, then proceeds to do something as a result.
Is the value in column A larger than the value in column B?
A B1 23 362 13 203 12 24 44 3255 100 106 3 507 40 100
Logical test using operators (=, <, <=, >, >=)
Formula:
=IF(A2>B2,"yes","no")
If true, the cell displays Yes
If false, the cell
displays No
First No Second No Is Column A bigger?
13 20 no
12 2 yes
44 325 no
100 10 yes
3 50 no
40 100 no
=IF(n4="m", "y", "n")
Text must be put in apostrophes e.g. “y”
=IF(R6=0,C6,"Paid")
The contents of C6 will be displayed if R6=0
C6 could contain another formula!
=IF(E33=1, “Good", IF(E33=2, “Average", “Below Average”))
=IF(E33=1, “Good", “Below Average”))
This structure is repeated before the False value.
An extra bracket is added at the end
= IF(G4>=80, "A", IF(G4>=65, "B",
IF(G4>=50, "C", IF(G4 >=45, "D", "Fail"))))
Using AND + OR:
=IF((AND(P24=0)),"Breakeven",(IF((OR(P24>0)),"Profit", "loss")))
Using Named cells
=IF(Product=“Pencil", “Student is organised!”, “Student needs pencil!”)
Using Absolute cell references
=IF($R$6=“Prussian Blue”, “My favourite colour”, “Not so good!")
The end
www.dragon-class.com