The next function we will discuss is
IF. The IF function will check the logical condition of a statement and return one value if true and a different value if false. The syntax is
- =IF (condition, value-if-true, value-if-false)
- value returned may be either a number or text
- if value returned is text, it must be in quotes
Let's use the table here for the discussion that follows. We will look at several different specific examples that show how the IF functions can be used! |
|
A
|
B
|
1 |
Price
|
Over a dollar?
|
2 |
$.95
|
No
|
3 |
$1.37
|
Yes
|
4 | comparing # | returning # |
5 |
14000
|
0.08
|
6 |
8453
|
0.05
|
|
Example of IF typed into column B | Compares |
Answer
|
=IF (A2>1,"Yes","No") | is ( .95 > 1) |
No
|
=IF (A3>1, "Yes", "No") | is (1.37 > 1) |
Yes
|
=IF (A5>10000, .08, .05) | is (14000 > 10000) |
.08
|
=IF (A6>10000, .08, .05) | is (8453 > 10000) |
.05
|