Chapter 8

IF Functions

SIMPLE IF FUNCTIONS

The IF Function is a frequently used function. When decision makers and analysts are looking for an optimal solution to a given problem, they often need to take into account complex models. The IF Function allows decision makers to consider more than one alternative.

The simplest IF Function in Excel answers first the question: “Is a condition true or false?” and then the software proceeds to take action based on the answer. The IF function has three parts/arguments:

1. Logical test—what are we asking? Or what is the question?
2. Value if true—what do we want displayed if the answer to our question is “true”?
3. Value if false—what do we want displayed if the answer is “false”?

The syntax or the structure of the IF Function is as follows: =IF (logical test, value if true, value if false). Within the parentheses, you create the three parts/arguments separated by a comma (,).

Or in simpler terms:

=IF (condition, action or value if condition true, action or value if condition false).

Consider a simple example:

In Figure 8.1, I have two groups of numbers (1 and 2) and I want to point out the numbers in group 1 that are larger than the ones in group 2 in the same rows. I want to type “yes” when they are larger and “no” when they are not. I use the IF function to do so.

FIGURE 8.1 Using the IF Functions for Comparisons

image

I inserted the IF ...

Get Next Generation Excel: Modeling In Excel For Analysts And MBAs (For MS Windows And Mac OS), 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.