The If Function Stud Notes
The If Function Stud Notes
Objectives
The “If function” is used when you need to perform a logical test on the
contents of a cell or group of cells to determine a result. The result produced is
based on a condition. If the condition is true, then the first value is produced, if
the condition is false, then the second value is produced. The following
comparison operators are used in the If function:
Operator Meaning
> Greater than
= Equal to
>= Greater than or equal
to
< Less than
<= Less than or equal to
<> Not equal to
Comparison operators are used to check the content stored in a cell against an
expected value. For example, to find out if a student is under 16 years old, we
would use the < operator.
1. Single Condition
• Condition – is the logical test and is any value or expression that can
evaluate to TRUE or FALSE. Conditions or values which are text should be
put in double quotation marks e.g. “Male”
• Value_if_true – is the value that is returned if the logical_test is TRUE. •
Value_if_false – is the value that is returned if the logical_test is FALSE
Components of If Function
Each if function MUST consist of all (11) eleven components in the order
given below:
1. =
2. If
3. Open bracket – (
4. Cell address to be tested
5. Comparison operators (e.g. >, <, =, <>, >=, <=) Condition (4 – 6) 6.
Value to be tested
7. Comma - ,
8. Value if condition is true
9. Comma - ,
10.Value if condition is false
11.Closed bracket - )
Example: Given the spreadsheet below and told that, boys pay $50 while girls
pay $75, write the function to insert the entry fee for the first student:
A B C
2 Daveta Female
3 Ryan Male
4 Alicia Female
5 Nigel Male
Answer