Conditional Functions

Conditional functions are functions that must satisfy a condition. If the condition is met, Excel displays a set value. If the condition is not satisfied, Excel will give a different value.
I think most functions are familiar for most students who are following this course, but I will repeat them just in case.
When we see the formula below, we read: If D12 is equal to “”, or nothing, then it is instructed to do “” or also nothing. If this condition is not satisfied, meaning there is something in cell D12, it is instructed to perform the formula C12 * D12.
So you see in the image below, there is a value of 90 (A) in D12, so it performs the multiplication of C12 * D12 (B) or 90X6.

les16_image001_en

In case the condition is satisfied and there is no value is in the D12 cell (C), nothing happens and nothing is displayed in cell E12 (D).

les16_image002_en
Note that for this and other formulas, when you want to type values as text, the value must appear in quotes “”. When entering values as numbers, quotation marks are not necessary.

IF function together with the SEARCH function

In the next example, we will show the IF function used together with the VLOOKUP function. We have covered the VLOOKUP function in the second lesson of this course, so I need not give any more detail here. Refer to lesson 2 if you feel you need to refresh your knowledge of the VLOOKUP function.

Let’s interpret below formula:

IF A12 (1) is equal to nothing (2), it will return nothing (3). If this is not the case, please return a “product”, look up the price of this product in the “products” worksheet (4), and return the contents of the second column (5) of this worksheet.

les16_image004_en

les16_image003_en

A word of explanation:

As always, we begin the formula with an “equals” sign “=”.

We type the name of the function “IF“and the opening parenthesis“(

Then we type the condition A12 = “”

And give the value when it is true and the value when it is not true, in “”, VLOOKUP (A12, products, 2, 0)

When the value if true, nothing (“”) happens. When the value is not true, a different function is initiated, namely, the VLOOKUP function.

After typing this additional function we open the brackets again ( and we type the value it has to start searching. This is the value indicated in the cell A12.

We type the worksheet in which it must look. This is the products worksheet. Next we add the column in which it provides the information to start searching. This is the second column, 2.

Lastly, we specify whether the data we seek in the table must be an exact match or whether it can be a partial data match.

Since all my products begin with the words “private course”, they are all the same. So I give a zero value 0 (true) here for an exact match. If this is not the case, type 1 or FALSE.

Last, we type the two closing parenthesis )). Once for the first IF function and second for the second VLOOKUP function.

Awesome!
You've completed Lesson 16
START NEXT LESSON