Using the IF Function in Excel 2007

Written by:  • Edited by: Bill Fulks
Updated Nov 23, 2009
• Related Guides: Microsoft | Excel | Excel Ribbon

If you’re still sorting through spreadsheet data manually, it’s time to learn how some of the functions in Excel can increase your productivity. In this article, we’ll take a look at the IF function and give an example of how it can be used.

What is the IF Function?

Microsoft Excel 2007
click to enlarge
The IF function in Microsoft Excel allows you to check a specific condition or set of conditions in your data, and then associate a result to your data based on the outcome of that analysis.

For example, an instructor may have a list of all student grades and want to assign a passing mark to those who answered at least 70% of the questions correctly and a failing mark to the others. Rather than going through the entire list one student at a time, it’s possible for the instructor to write one IF statement that will check each student’s grade and make that assignment for him.

An IF Function Example

In this article, we’ll start by taking a look at an example using the situation described in the previous section. This is one of the simplest types of IF functions to create since it only has two possible values. We will cover more complex examples of IF functions with multiple values later in this series.

The screenshot below shows how our data has been entered in Excel. (Click the image for a larger view.)

Data for Example
click to enlarge

In the Pass or Fail column of this worksheet, we want to enter a formula that will perform the following tasks.

  • Assign a value of Pass if the Percentage Correct is greater than or equal to 70.
  • Assign a value of Fail if the Percentage Correct is less than 70.

In the following section, we’ll walk through the process of creating this IF function step-by-step.

Creating the IF Function

Step 1: Select the first empty cell in the Pass or Fail column.

Step 2: Open the Formula tab on the Excel ribbon. Click on the arrow underneath Logical in the Function Library section to expand the menu. Select IF from the menu options.

Formula Tab
click to enlarge

Step 3: In the Function Arguments window that appears on your screen, you will be asked for three items: the Logical test, the value if true, and the value if false.

Function Arguments Window
click to enlarge

In our example, we are testing to see if the value of the number in the Percentage Correct column is greater than or equal to 70. In Excel terms, this translates to the statement:

B2>=70

If this condition is true, we want the function to return the value “PASS”. Otherwise, we want it to return the value “FAIL”. A closer view of how this information is entered into the Function Arguments window can be seen below.

Close Up View of Function Arguments Window
click to enlarge

Step 4: Click OK after entering the information. The function will be immediately evaluated in the worksheet.

Value Shown in Worksheet
click to enlarge

Step 5: Copy the formula just created and paste it into the other empty cells of the column.

Completed Calculations
click to enlarge

Note: If for some reason the function is not evaluated or if it looks like it is being evaluated incorrectly, make sure that you have the Automatic calculations feature activated. To check this, click on the Calculation Options button in the Formula tab and see if there is a check mark next to Automatic.

Next in this series, we’ll take a look at how to create IF functions for conditions that have more than two possible values.


Comments

Showing all 7 comments
 
Ahnt_2004 Jan 30, 2012 11:06 AM
RE: Using the IF Function in Excel 2007
Many thanks indeed it was great I got my answer. <br>
Izzie5 Jan 7, 2012 1:09 AM
RE: Using the IF Function in Excel 2007
I am working on a billing work sheet for water system, my qustion is. I want to it calulate the amount of the bill based on the amount of water used. Example, Cell E3 current meter read/ Cell F3 previous meter read/ Cell G3 = amount used. What I want to do is have Cell H3 calulate a doller amount based on as a set range value
Michele McDonough Jan 16, 2011 8:06 PM
RE: Using the IF Function in Excel 2007
Do you need the function to pull information from cells on different sheets? If so, you can reference the sheet name in your formula.

For example, if you need the data from cell A1 on Sheet1, instead of just entering A1 into your formula, you would enter 'Sheet1'!A1 - the rest of the formula would work like any IF statement.
Michelle Smith Jan 16, 2011 5:17 PM
Excel Project
I have an Excel project that I am working on using my families business. The workbook contains a different sheet for each month regarding the expenses for the company. For my project I have to create an IF function but for the life of me don't know what to do it on. Any ideas?
Sha Jan 15, 2011 2:21 AM
RE: Using the IF Function in Excel 2007
I have table in sheet2 i want these details in sheet1 giving date criteria. anyone can help me please ???
sara benazeer Jun 22, 2010 12:20 PM
excel
thank you for helping people who doesn't know much about the use of excel 2007. May God bless u
mr.mahlooji Jan 4, 2010 7:44 AM
tanks
tanks
 
blog comments powered by Disqus
Email to a friend