The brackets around those arguments indicate that they’re optional. So if you do not provide one of these arguments, either the Value-If-True or the Value-If-False, or both, then the outcome of the IF() Function will be simply the logical value TRUE or FALSE, depending on the result of the Logical Test. Let’s take a look at the table provided for our example.
We’ve got a table. It’s a mini report comparing Sales Tax Rates from two different Monterey County cities, and you can select cities from your drop down lists in the row labeled City. Then, the Sales Tax of each of those selected cities will be displayed in the row labeled Sales Tax. The row labeled Result1 will have a message in the column
in which the city with the HIGHER Sales Tax Rate is represented. If they’re the same, if the two cities have EQUAL Sales Tax Rates, you won’t see a message in either one of these cells, because they will both result in a null message. Result2 will have a message if the Sales Tax Rates are equal. We’ll see a message in this bottom row saying that they are the same. So let’s take a look at how the IF() Functions are constructed. If I double click in the cell I can see the entire function in my formula bar up here, and we can see the Logical Test compares the Sales Tax Rate in column B to the Sales Tax Rate in column C. The Logical Test States: B8 > C8. So we have a logical operator helping to form our logical test: that greater than symbol (>). If it’s TRUE that B8 >C8, then the outcome of the function will be what we’ve constructed in the Value-If-True argument of this function, and that is a message concatenating the names of the cities with a text string between the two city names. So, if it’s TRUE that B8 > C8, we’ll have a message that has the city name in B7, concatenated with the text: ” has a higher Sales Tax Rate than ” concatenated with the city name in C7. However, if it’s FALSE that B8 > C8, then we’ll have the outcome: Value-If-False, which will be a null value indicated by “” with nothing between the quote symbols. The cell will have a null message; the cell will have an empty value.
Notice, we have that same IF() Function structure in column C, but it’s the opposite. Here our Logical Test is: C8 > B8. And if that’s TRUE, then we have the message saying that the city named in C7 has a higher Sales Tax Rate than the city named in B7. So let’s watch how this changes if
I pick a name
to, let’s see, let’s go with Castroville.
Between Castroville and Soledad: now Soledad has a higher Sales Tax Rate than Castroville. Now what happens if I pick two that have the same? I’m going to pick Pacific Grove.
And we see that Pacific Grove and Soledad have the same Sales Tax Rates. Let’s take a look at this IF() function. Here our logical test is: if B8 = C8. Then we’re having a message that the Sales Tax Rates of the two cities are the same, otherwise we’re having a null value (“”) in our response. Thank you.