Office 2016 For Seniors For Dummies
Book image
Explore Book Buy On Amazon

Excel’s IF function intimidates a lot of people, but it’s really not that conceptually difficult. The IF function determines whether a statement is true or false, and then takes one of two actions depending on the answer.

Let’s look at a plain-English example. Suppose that when the sum of C2 and D2 is greater than 100, you want to display in E2 the result of multiplying the sum of C2 and D2 by 0.05. On the other hand, when C2+D2 is not greater than 100, E2 should show 0.

The syntax for the IF function is:

=IF(<i>condition,value_if_true,value_if_false</i>)

So first let’s write the condition:

C2+D2>100

If the condition is true we want to do this math for the value_if_true :

(C2+D2)*0.05

Notice that there are parentheses around the addition operation. Without these parentheses, it wouldn’t be done first; in the order of operations, multiplication comes before addition.

The third part of the function, the value_if_false, is 0.

Filling these values into the function, it looks like this:

=IF(C2+D2>100,(C2+D2)*0.05,0)

If you have more than two possible conditions, and you want something different for each condition, you can nest one IF function inside another. You can handle two of the conditions in the inner IF, and then apply the third condition in the outer IF.

Here’s an example to work through. Suppose that we want to display some text according to the value of C2+D2. When C2+D2 is greater than 100, we want to show the text Good and when C2+D2 is greater than 50 but less than 100, we want to show the text Fair. When neither of those conditions is true, we want to show the text Poor.

We start by evaluating the first condition as the value_if_true:

=IF(C2+D2>100,"Good")

The value_if_false will be another IF statement:

=IF(C2+D2>50,"Fair","Poor")

Putting them together — you omit the = sign for the nested function — looks like this:

=IF(C2+D2>100,"Good",IF(C2+D2>50,"Fair","Poor"))

Notice the three closing parentheses at the end, one for each IF.

Now that you know how IF functions work, you can string together as many levels of nesting as you need to get the job done.

About This Article

This article is from the book:

About the book author:

Faithe Wempen a Microsoft Office Master Instructor and the author of over 140 books on computer hardware and software, including Excel 2013 for Dummies eLearning Kit and PowerPoint 2013 Bible. She is also an adjunct instructor of Computer Information Technology at Purdue University and an A+ certified PC technician.

This article can be found in the category: