IF Function
IF Function
Grade
A
B
C
* Note that each invoice will fall in only one of the two columns.
he no. of days
Today's Date 12/14/2017
Student Gender Score Pass/Fail Letter Outlier
Jill F 90
Tom M 80
Brittany F 96
Alan M 72
George M 69
Sally F 52
Chris M 99
Jamie F 82
Valorie F 67
Steve M 90
Jake M 83
Lori F 89
Meghan F 60
Michelle F 63
Tim M 59
To enter
To enter aa basic
basic IF
IF function:
function:
Enter the
Enter the formula
formula =IF(condition,expression1,expression2),
=IF(condition,expression1,expression2), wherewhere condition
condition isis any
any condition
condition that
that isis either
either true
true or
o
false, expression1 is the value of the formula if the condition is true, and expression2 is the value of the
false, expression1 is the value of the formula if the condition is true, and expression2 is the value of the formula i formula
the condition
the condition isis false.
false.
Asimple
A simple example
example isis =IF(A1<5,10,“NA”).
=IF(A1<5,10,“NA”). Note
Note that
that ifif either
either of
of the
the expressions
expressions isis aa label
label (as
(as opposed
opposed to
to aa numeri
numer
value), itit should
value), should be
be enclosed
enclosed in
in double
double quotes.
quotes.
Try it!
Try it! Enter
Enter appropriate
appropriate IF
IF formulas
formulas in
in columns
columns CC and
and D.
D. (Scroll
(Scroll to
to the
the right
right to
to see
see the
the answer.)
answer.)
Sometimes IF
Sometimes IF functions
functions are
are nested.
nested. For
For example,
example, there
there might
might be
be three
three possibilities,
possibilities, depending
depending on
on whether
whether the
the val
val
in cell A1 is negative, zero, or positive. A nested IF formula can then be used as follows.
in cell A1 is negative, zero, or positive. A nested IF formula can then be used as follows.
To use
To use nested
nested IF
IF functions:
functions:
Enter the
Enter the formula
formula =IF(condition1,expression1,IF(condition2,expression2,expression3)).
=IF(condition1,expression1,IF(condition2,expression2,expression3)). IfIf condition1
condition1 isis true,
true, th
th
relevant value is expression1. Otherwise, condition2 is checked. If it is true, the relevant value is expression2.
relevant value is expression1. Otherwise, condition2 is checked. If it is true, the relevant value is expression2.
Otherwise, the
Otherwise, the relevant
relevant value
value isis expression3.
expression3.
An example
An example isis =IF(A1<0,10,IF(A1=0,20,30)).
=IF(A1<0,10,IF(A1=0,20,30)). Suppose
Suppose this
this formula
formula isis entered
entered in
in cell
cell B2.
B2. Then
Then ififA1
A1 contains
contains aa
negative number,
negative number, B2B2 contains
contains 10.
10. Otherwise,
Otherwise, ififA1
A1 contains
contains 0,0, B2
B2 contains
contains 20.20. Otherwise
Otherwise (meaning
(meaning that
thatA1
A1 must
must
contain aa positive
contain positive value),
value), B2
B2 contains
contains 30.
30.
Try it!
Try it! Use
Use aa nested
nested IF
IF function
function to
to fill
fill in
in the
the grades
grades in
in column
column C.
C. (Scroll
(Scroll to
to the
the right
right to
to see
see the
the answer.)
answer.)
mplex. II will
mplex. will provide
provide aa few
few For each product, if the end inventory is less than or equal to 50 units,
enough units are ordered to bring stock back up to 200; otherwise, no
units of that product are ordered
y condition
condition that
that isis either
either true
true or
or Product End inventory Order placed (yes or no)?
n2 is the value of the formula ifif
n2 is the value of the formula 1 100
2 40
3 20
a label
label (as
(as opposed
opposed to
to aa numeric
numeric
4 70
e the
the answer.)
answer.)
depending on
depending on whether
whether the
the value
value
llows.
lows. Each student gets an A (if score is 90 or above), S for satisfactory (if score
if 60 or above but less than 90) or U for unsatisfactory if score is below 60
sion3)).
ion3)). IfIf condition1
condition1 isis true,
true, the
the Student Score Grade
evant value is expression2.
evant value is expression2. 1 70
2 95
ell B2.
B2. Then
Then ififA1
A1 contains
contains aa 3 55
ell
erwise (meaning
erwise (meaning that
thatA1
A1 must
must 4 80
5 60
6 90
tt to
to see
see the
the answer.)
answer.)
an or equal to 50 units,
p to 200; otherwise, no
# of units ordered
-
-
-
-