Home > Articles > Home & Office Computing > Microsoft Applications

Exploring Excel's Functions: IF() Only!

How often will you need to calculate the prorated linear depreciation of an asset? Heck, do you even know what that means? But if you need that calculation, Excel's built-in AMORDEGRC() function can save you time and hassle. Many users do not take full advantage of Excel's functions, simply because they don't know what is available or they're not quite sure how to use them. Peter Aitken hopes to remedy this situation. This first article in a series that will explore some of Excel's less well-known functions discusses one of its most useful ones: the IF() function.
Like this article? We recommend

For more information on Microsoft Office, visit our Microsoft Office Newsletter.

As any Excel user knows, the program provides you with a whole raft of built-in functions for use in your worksheets. These functions range from the simple, such as summing a column of numbers, to the obscure and complex. How many of us will ever need to calculate the prorated linear depreciation of an asset? Heck, I don’t even know what that means! But if you need that calculation, Excel’s built-in AMORDEGRC() function will save you time and hassle.

Many users do not take full advantage of Excel’s functions simply because they do not know what is available or, for the more complex ones, are not quite sure how to use them. I hope to remedy this situation. This is the first article in a series that will explore some of Excel’s less well-known functions. My goal is to avoid both the simple functions [SUM() and AVERAGE(), for example] and also to avoid the highly specialized functions that will be of interest to a very limited group of people. Instead, I will focus on those functions that are general enough in their application to be widely useful, and that also are—at least for some people—somewhat obscure in their details.

What If?

One of my very favorite functions is IF(). It has wide applicability and is very flexible. As the function name suggests, IF() lets you ask a question. More specifically, it lets you ask a question that has a True or False answer and then display one of two items, depending on the answer. The function takes three arguments as shown here:

=IF(condition, true_value, false_value)

The condition argument is your question. In Excel-talk, it is a logical expression that compares two values and returns True or False. You can perform any of the following six comparisons:

Symbol

Comparison

=

Is equal to

<>

Is not equal to

>

Is greater than

<

Is less than

>=

Is greater than or equal to

<=

Is less than or equal to

You can compare the values in worksheet cells with other worksheet cells or with literal values types in directly. Here are some examples:

Logical Expression

Meaning

G5 < 0

Is the value in cell G5 less than 0?

G22 <= G23

Is the value in cell G22 less than or equal to the value in cell G23?

A1="New York"

Does cell A1 contain the text "New York"?

A1+A2>100

Is the sum of the values in cells A1 and A2 greater than 100?

A1>A2/2

Is the value in cell A1 greater then one-half of the value in cell A2?

Now let’s look at the other two arguments. The first one is what you want displayed in the cell if the condition is True, and the second one is what you want displayed in the cell if the condition is False. You have a good deal of flexibility here because you can use:

  • A literal value (text in quotes or a number without quotes)
  • A cell reference
  • A formula

Here are some examples. The cell containing this IF() function will display "Overdrawn" if the value in cell G20 is less than 0, and "Balance OK" if the value is 0 or above:

=IF(G20<0, "Overdrawn", "Balance OK")

This IF() function will display the larger of the values in cells A1 and A2:

=IF(A1>A2, A1, A2)

In the next example, the IF() function displays the text "REORDER" if the value in cell H10 is less than 10, and displays nothing if the value is 10 or greater.

=IF(H10<10, "REORDER", "")

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.