Upload
zkkoech
View
11
Download
4
Embed Size (px)
DESCRIPTION
Excel if Function
Citation preview
1
The IF function
Lesson 2 D
The IF Statement
This is an excel formula that is used to evaluate the contents of a single cell, compares the contents of this cell against a given value or statement, to return a TRUE value, statement or formula if the tested condition is positive; alternatively, it returns a FASLE statement, value or formula if the tested condition is negative
The IF Statement
Exercise 1 To determine the age status of students, create a
column called “AGE STATUS” and using IF statement compare their ages against the value 18. if they are 18 and above, it return ADULT else, it should return MINOR
The IF Statement
Assume you are testing C6 =IF(C6>=18,"ADULT","MINOR")
NOTE: No spaces when typing the formula, except for
contents enclosed in quotes
The IF Statement
Exercise 2 Create a column called NEXT CLASS and using the IF
statement analyze the student’s average scores; compare them against the value 68. if they are equal to or above, it should return NEXT CLASS else, failure should return REPEAT CLASS
The Nested IF Statement Unlike the standard if statement, it evaluates the
contents of a single cell, compares the content of this cell against several given values or statements, to return several TRUE values, statements or formulas if tested condition is positive, alternatively it returns a single FASLE statements or formulas if tested condition is negative
The Nested IF Statement Exercise 3 To determine the age group status of students,
create a column called AGE GROUP, and using the nested if statement compare their age against the following values:-
>= 60 Old Man >= 13 Teenager >=35 Middle Aged >= 7 Toddler >= 20 Youth >7 Infant
The Nested IF Statement
=IF(A3>=60,"OLDMAN",IF(A3>=35,"MIDDLE AGE",IF(A3>=20,"YOUTH",IF(A3>=13,"TEENAGER",IF(A3>=7,"TODDLER","INFANT")))))
The Nested IF Statement NOTE: No spaces while typing or building the formula. The number of brackets enclosing the whole Nested
IF statement is directly proportional to the number of IF statement used within the formula.
The last item within the IF statement is not analyzed as it come by default on the failure of all the tested conditions
The nested IF statement can only analyze up to a maximum of 7 (seven) IF statements
The Nested IF Statement
The Nested IF Statement Exercise 4 Create a column called GRADE, and using the Nested IF
statement analyze the student’s AVERAGE scores, compare them against the pre – rated grades which could either be DISTICTION, CREDIT, PASS or FAIL.
NOTE: You have to sit down and work out your ranges for the appropriate grades.
LET >=70 =DISTINTION >=68 = CREDIT >=60 =PASS BELOW 60 = FAIL
The Nested IF Statement
=IF(N6>=70,"DISTINTION",IF(N6>=68,"CREDIT",IF(N6>=60, “PASS",,"FAIL")))))
LOGICAL IF
These make use of logical operations like OR, AND & NOT to evaluate cell contents
AND …. ALL tested conditions MUST be met for the True Value statement or Formula to come.
OR……. The True Value, Statement or Formula comes if ANY of the tested conditions returns positive.
NOT…..Works from the opposite side of the standard IF statement
LOGICAL IF
IF (AND) Statement
This Logical IF statement, evaluate the contents of several cells, maximum 30, compares the contents of these cells against several given values or statements, to return a single, TRUE value, Statement or formula if tested conditions are ALL positive; alternatively it returns a single FALSE statement, value or formula if ANY of the tested condition is negative
LOGICAL IF
IF (AND) Statement
Exercise To determine students who qualify to get a price, the school’s
management has stipulated that the following conditions must be met
Mathematics > 65 English >70 Age >=18 Average >= 68 If all these conditions are met it should return the prize as the
Student’s average multiplied by 100; however, failure on any should return NO PRIZE
LOGICAL IFIF (AND) Statement
Solution
Assuming Mathematics is in cell B1, English in B2, Age in B3, and Average in B4
=IF(AND(B1>65,B2>70,B3>=18,B4>=68),B4*100,"NO PRIZE")
LOGICAL IFIF (AND) Statement
Exercise
Africa Nazarene University is offering scholarships to sponsor students to pursue MBA programme. However, for the scholarship, students must meet the following conditions as outlined by the donors:
BCM 101 > 80 FIN 405 > 85 ACC 311 >= 70 UCC 101 > 65 AGE >= 25 AVERAGE >=75 If all these conditions are met it should return the scholarship as the
Student’s average multiplied by 3000; however, failure on any should return NO SCHOLARSHIP
LOGICAL IFIF(OR) Statement
This Logical IF statement, evaluate the contents of several cells, maximum 30, compares the contents of these cells against several given values or statements, to return a single, TRUE value, Statement or formula if ANY of the tested conditions is positive; alternatively it returns a single FALSE statement, value or formula if ALL of the tested conditions return negative.
LOGICAL IFIF(OR) StatementExercise To determine the students who qualify to go for a tour, Africa
Nazarene University has decided that any of the following conditions should be met
UCC 101 > 85 AGE >= 18 AVERAGE >= 60 If ANY of these conditions is met it should return GRANTED;
however, failure on ALL should return DENIED
LOGICAL IFIF(OR) Statement
ASSUME UCC 101is in cell D3, AGE is in cell D4 and AVERAGE is in cell D5
=IF(OR(D3>85,D4>=18,D5>=60),"GRANTED","DENIED")
LOGICAL IFIF(OR) Statement
Africa Nazarene University a class representative elected for each course. The representative is elected by the students and should met any of the following University’s requirements.
UCC 101 >= 80 AGE > 25 AVERAGE >= 83 If ANY of these conditions is met it should return CANDIDATE;
however, failure on ALL should return NO CANDIDATE
LOGICAL IFIF(NOT) Statement
Works for the opposite of the standard IF Statement.
LOGICAL IFIF(NOT) Statement
Exercise Example to determine the age status of students, create a
column called “AGE” and using IF(NOT) statement compare their ages against the value 18. If they are 18 and above, it return ADULT else, it should return MINOR
LOGICAL IFIF(NOT) Statement
Assume you are testing C6
=IF(NOT(C6>=18),"MINOR”, “ADULT“
OR
=IF(C6>=18,"ADULT","MINOR")
LOGICAL IFIF(NOT) Statement
Exercise
Create a column called NEXT CLASS and using the IF(NOT) statement analyze the student’s average scores; compare them against the value 68. If they are equal to or above, it should return NEXT CLASS else, failure should return REPEAT CLASS
LOGICAL IF
IF(NOT) Statement
Solution ??