Site hosted by Angelfire.com: Build your free website today!

IF Function

Function Basics Insert Function AutoSum IF Function
PMT Function Date Functions DATEDIF Function Lookup Functions
New 07 Functions Time Functions Text Functions Rounding Functions
Stat Functions Other Functions SUBTOTAL (.xls) SUMPRODUCT (.xls)
IF
The Excel IF function returns one value if a condition you specify evaluates to TRUE, and another value if that condition evaluates to FALSE.
Syntax: IF(logical test, value if true, value if false)
The logical test can use any combination of values, cell references, and comparison operators that can be evaluated as true or false.
IF Function
If an employee has signed up for insurance, we need the Deduction column to contain the value 235.
Formula for Deduction: =IF(C11="Yes",235,0)
The logical test is checking to see if C11 contains the text Yes. If it does, it returns the value of 235. If it does not, it returns the value of 0.
IF Function with Calculation
Employees are entitled to 5 days of vacation after one full year of employment, plus an additional day for each additional year.
Formula for Vacation Days: =IF(C19>1,INT(C19)+4,0)
The logical test is checking to see if the years of employment is greater than one.  If it is, it uses the INT (integer) function to remove the decimal portion from years employed and adds four to compute vacation days. If not, a value of zero is displayed.
Nested IF Functions
Compute deduction depending on if coverage is for self, family, or not at all.
Formula for Deduction: =IF(C27="Self",235,IF(C27="Family",505,0))
The first IF function is checking to see if C27 contains the word Self, if so it returns 235, if not it activates the second IF function, which tests to see if it contains Family. If it does it returns 505, if not it enters 0.
IF function with Logical OR
Teams A and C meet on Tuesday, Teams B and D meet on Thursday. We want to list the meeting days in column D.
Function for Meeting Day: =IF(OR(C35="A",C35="C"),"Tuesday", "Thursday")
OR is a logical function that returns true if any of the listed comparisons are true. Because Jorge is in Team A, the OR function returns TRUE and his meeting is on Tuesday. Because Joe is in neither A or C, the OR function returns false and his meeting is on Thursday.

Download the sample workbook functionsamples.xls or for 2007 users functionsamples07.xls.

Return to the Top