3. The Logical_test is where you put your argument — which must return an answer of
true or false. In the above figure we refer to Julia Richards’ exam result in C6 and
ask if it is greater than or equal to 10. Note the “TRUE” message.
4. Value_if_true — Type the word "Pass" (If using the Function Wizard the double
quotation marks are automatically typed in for you). Note the result at the right-
hand side of the dialog window. This is the result you will get if the argument is.
TRUE.
5. Value_if_false — Type the word “Fail”. This is the result you will get if the argument
is FALSE.
J —— Results that
will be used
nf fon Far Ber | after the
J — logical test
Checks ubetheracandtion rt, aradveties ore value TLE, ae athe vei has been
ra ‘completed.
Yel Salta aod tae ASE. te PE
Foro ros
indcaaiistiamiad om cancel
6. Click on OK to finish the function. If filing several cells with this formula, use the
FILL HANDLE to drag down to the other cells. (see Page 14 to read more about
the FILL HANDLE)
NOTE: The arguments are not always text, it can be another formula or a value, or if a
null (no result) is required, nothing (or “. i.e. nothing between the double
quotation marks).
Creating the IF Function - Example 2
The second example — using sales commission, requires a formula to be used,
Logical test [R55=45}21 B= ratse
vale tue [mee SSCS
vauestteelf ____iI=0
Checks hte a cordon, ae curs on vale TRUE, a arate vf
Value_i flse she wavs thet srehmesifLogcaL. testis FALSE orto, FL s
uae
Heloco isu
‘SAdministatvelnormation Techaalogy/ Customer Sewees ManagementEaucaton and Training TeariGuvrent Trang Page 37
Modulos\Advanced ExcaiAavanced Excel formulas and funetone oeIn this case the Logical_test is asking if the value in B25 (on the IF FUNCTIONS.
worksheet) is greater than or equal to B21 (the target the salespeople have to achieve in
order to get any commission, note that this reference is Absolute).
The Value_if_true is saying if the target is achieved, multiply the amount by 5%.
The Value_if_false is saying if the target is not achieved, give 0 commission
Manually Creating an IF Function
Once you are confident with IF functions you may decide to type the formula rather than
use the FUNCTION ARGUMENT dialog box. Just remember:
* Touse =IF as the function
‘* Inside the parenthesis (brackets) you have 3 arguments which MUST be separated by
‘commas (,)
‘+ Ifyou require a result to be text, the text must be enclosed inside double quotation
marks e.g. "Pass" or "Fail" or" (the latter is to have no text appear)).
=IF(B25>=B21,B25*5%,0)
or
=IF(B25>=B21,B25*5%,
‘Sdministatvellnformation TechnologyiCustomer Sevces Managementieducston and Training TeariGurrent Trang Page 38
Modulos\Advanced ExcaiAavanced Excel formulas and funetone oeNESTED IF FUNCTION
Occasionally a single IF statement may not be enough to give you the results you are
looking for, The traditional example of this is taking the student example a little further. In
the figure below, (which is in the Advanced Excel Exercises workbook), Column D is the
normal IF function done in the last exercise which finds out whether the student has
passed or failed. Column E, however, is asking what grade the student is to receive based
on the following table:
A 17-20 ' i =
Boo (1416 Zi ein a eee
c 14-13 i
D ato suname (Con | sew | Pasa Gade
E 7 or below a ‘oe
2 om te Le
Stet Sys 3 he
{0 Gost cps a
1 Se 1 fe
ie te ae
The normal IF Function will not give you the required result. You need more than one IF
function to complete the job — you can do this with a NESTED IF FUNCTION i.e. more
than one IF Function, one inside the other (you are allowed up to 7 nested functions)
Put in simple terms, our nested IF statement is going to be:
First IF statement:
Logical test —see if C6 is a value of 7 or below (C6<=7)
Wtrue- Give an "E” grade
Iffalse- see IF C6 is a value of 10 or below to work out whether this student should
have a “D” grade — this will lead to the second IF statement
‘Second IF statement:
Logical test - see if C6 is a value of 10 or below (C6<=10)
Iftrue- Give a“D” grade
Iffalse- see IF C6 is a value of 13 or below to work out whether they should get a “
grade — this leads to the third IF statement
Third IF statement:
Logical test - see if C6 is a value of 13 or below (C6<=13)
Iftue- Give aC” grade
Iffalse- see IF C6 is a value of 16 or below to work out whether they should get a “B”
grade — this leads to the fourth (and last) IF statement
Fourth IF statement:
Logical test - see if C6 i
a value of 16 or below (C6<=16)
itue- Give a°B” grade
If false - it must be true that C6 etween 17 and 20 as there are no other possible
marks left. Therefore “A” should be entered here to indicate the top grade
possible.
:Adrinistatvelitormatn Tecnology Customer Saves Menagementdicaton and Tain TeamGurentanng Pape30
Modulos\Advanced ExcaiAavanced Excel formulas and funetone oe