You are on page 1of 6

Microsoft Excel

Conditional Functions

Managerial Accounting Lab, Second Year

Prepared By
Assistant Lecturers
Businesses Informatics College

Introduction
This lectures covers the use of the "If statement" in excel, IF is a
command that test if a condition is met or not, then execute
.functions or set a value based on that test

:In excel the syntax of an IF statement is

IF(logic_test; value_if_true; value_if_false)=

 Logic test : the condition we are testing for


 value_if _true :what we want the value to be if the condition is true
 value_if_false: what we want the value to be if the condition is false.

Example
In this example, we have a list of student's names with their
absence percentage, we want to assign them a mark based on
that, a student with less than 10% absence rate gets a mark of 0,
an absence rate equal to or higher than 10% gets a one.
AND / OR
Excel can check for multiple conditions if needed, simply by using
"AND" or "OR" statements, to do so we use the following syntax

IF (AND(logical1; logical 2,…); value_if_true; value_if_false)


IF (OR(logical1; logical 2,…); value_if_true; value_if_false)

Logical1, logical 2… : these are our test conditions, we can have


two or more conditions this way

Example
Consider the previous example, this time add a participation mark
Write the equation to:
a. Give a student a mark of 1 if absence percentage is less or
equal to 10% and participation is above 1
b. Give a student a mark of 1 if absence percentage is less
than 8% or participation above 1.5
Nested if
Sometimes we can use an if statement inside another because we
only want to check for the second condition if the first is true, the
nested if can be in the "true" section or the "false" section
depending on the logical function we are testing for.

IF (logic_test; IF(logic_test; value_if_true; value_if_false); value_if_false)=

IF (logic_test; value_if_true; IF(logic_test; value_if_true; value_if_false))=

Exercise
Consider the previous example:
" Give a student a mark of 1 if absence percentage is less than 8%
or participation above 1.5"
Let's assume we want to keep it the same, but add a "+" to any
student whose participation is above 2
Using if with other function
Example 1
The following table is an example of a very simple sales table, we
want to set the "evaluation" value to "On track" if the sum of that
week's sales exceeds (900), or "Lagging" if the sum is below (900)

Example 2
The following table is for a library clerk, it stores the day the book
was borrowed in then compares it to today to find if the book is late
or not, a late book is one borrowed over 30 days ago.
Use the Today() function for reference
Homework:

Set formulas to find which books are late, and then assign a fine to
the ones that are late
The fine is: 10$ for 30-100 days delay
20$ for 100-200 days
100$ for anything over a year

You might also like