How to Write an IF Function for Microsoft Excel 2007
Excel 2007 provides functions to assist users performing calculations on worksheet data. Functions automate the process of calculating, counting, averaging, and in the case of an IF function, completing a test that delivers results based on whether a condition or conditions are true or false. The Excel 2007 IF function is widely used for calculations such as payroll deductions, overtime pay and with student grading procedures.
Instructions
-
-
1
Analyze the formula for an IF function. An IF function requires three things: A logical test, a value if true, and a value if false. The logical test is what you are testing for, such as a number that determines whether an employee receives overtime pay. The value if true is what will occur if the value equates to "yes," such as pay the employee at an overtime rate, while the value if false what will occur if the value equates to "no," or pay the employee at the normal rate. The basic structure for an IF function is =IF(logical_test, value_if_false, value_if_true).
-
2
Prepare a worksheet for a basic IF function. In this function, you will determine whether an employee with a base wage of 13.00 per hour receives overtime pay and if so, how much, by using an IF function. Open Excel 2007 and enter information in the following cells:
A3 -- Sarah Parker
A4 -- Ed White
A5 -- John Steele
B2 -- Pay Rate
B3, B4, B5 -- 13.00
C2 -- Total Hours
C 3 - 45
C4 -- 39
C5 - 41
D2 -- Overtime Pay -
-
3
Place your cursor in cell D3 and click to select it as the active cell. Select the "Formula" tab on the Excel Ribbon, then select "Logical" and "IF" to open the "Function Arguments" window. Excel will start the function by adding the function structure "=IF()" to the function bar just above the spreadsheet. The Function Arguments window will place your arguments within supplied parentheses.
-
4
Enter the following in the formula text areas and then click "OK" to enter the formula as view results. When you finish, the function should read in the formula bar as: =IF(C5>40,B5*(C5-40),0)
Logical_test: C3>40
Value_if_true: B3*(C3-40)
Value_if_false: 0 -
5
Copy and paste the IF function into remaining cells by right-clicking on cell D3 and selecting the "Copy" option and then right-clicking again to paste into cells C4 and C5. If correct, results should display as:
D3 -- 65
D4 -- 0
D5 -13
-
1
Tips & Warnings
You can improve the appearance of IF function results by formatting them according the data type. For example, you can format cells D3 through D5 by placing your mouse cursor in cell D3 and dragging it down to cell D5 to select all cells and then selecting the "Home" tab on the Excel Ribbon and from the "Number" section, select the dollar sign ($).
References
Resources
- Photo Credit cream cake sould i eat image by Warren Millar from Fotolia.com