0595 Ms Excel Using The If Function
0595 Ms Excel Using The If Function
The If function allows users to make logical comparisons between values, returning a value of either
True, or False. Based on the result of the logical comparison, the if function can carry out a specific
operation, based on a true or false value.
I F( Com parison, if t rue t hen perform t his act ion, ot herwise do som et hing else) .
The way Excel reads a function is by looking at the relationship of the cell references in relation to the
cell containing the function. For example, in the
function contained in cell C3 to the right, Excel
reads this as “take the number located two cells
to the left and add that to the number in the cell
located one column to the left”. Therefore, when this function (which appears as =A2+B2) is copied to
the cell below, it performs the calculation using the same pattern, “take the number located two cells to
the left and add that to the number in the cell located one column to the left”, but updates the formula
to reflect the appropriate cell addresses. This is called a Relative Reference and is the feature that
enables users to copy the same function to a different location within a worksheet.
To make a cell reference absolute so that it will not adjust when a formula is copied, insert a dollar sign
($) in the appropriate position. By navigating into the formula in the Formula bar, users can cycle
through the absolute reference options by hitting the F4 key on the keyboard. The first time the F4 key
is pressed, a user will create an absolute reference to the cell reference in the function, the second time
the reference will be to the row only, and the third time the reference will be to a particular column.
Two times
Three times
Example 1: $B$12 Both the Row and the Column are held Constant
Example 2: B$12 The Row is held constant; the Column will update as the function is copied.
Example3: $B12 The Column is constant; the Row will update as the function is copied.
The And and Or functions will allow for multiple logical expressions to be created within the argument of
the function. Each logical expression must be separated by a comma.
And Function
The And function is used to check multiple logical expressions and will return a True value if every one of
the logical expressions is true.
OR Function
The OR function is used to check multiple logical expressions and will return a True value as long as one
of the logical expressions is true.
1. Navigating to the cell to contain the IF function and type in an equal sign, followed by AND.
Select the AND function by double clicking on it, or using the arrow keys to select the function
and then hit the tab key.
2. When the function has been selected, type in the first logical expression. When the first logical
has been entered, type in a comma to enter in the second, third, fourth, etc. logical expression,
making sure each expression is separated by a comma.
3. When the AND function is complete, finish the function by entering in a closed bracket ).
a. Users may also use the formula bar to do this, as it may be easier to access the first
portion of the function in the formula bar.
5. With the cursor between the equal sign and the A, start typing if.
Excel will populate a list of functions under the cell. Either
double click on the If function, or use the arrow keys to highlight
IF and then hit the tab key.
6. Excel will now display the arguments for the IF function underneath the cell, or the formula bar,
depending on where the user is working. The argument that will be bolded will be the
logical_test, which has already been completed
with the AND function. To enter in to the second
portion, value_if_true, of the expression, move
the cursor to the far right of the AND function,
after the closed bracket and type in a comma.
9. When all arguments have been fulfilled, hit the type in a closed bracket to complete the
function.
a. Note: Users may hit the Enter
key to complete the function,
which may result in the
following error;
b. This error is just notifying the
user that the last closed bracket
is missing. By accepting this error, Excel will insert the closed bracket to complete the
function.
=IF(logical_test,value_if_true,IF(logical_test,value_if_true,value_if_false))
Tip: When comparing values within a scale, make sure the values are sorted in either increasing or
decreasing order to help make the nested if statement easier to assemble. If the scale is in Increasing
order, the less than < sign will be used in the arguments and if the scale is in decreasing order, the
greater than > sign will be used in the arguments.
2. Enter in the first logical test within the If function, then hit the comma key to get to the
value_if_true.
3. In the value_if_true portion of the argument, enter in what is to be done if the first logical test is
true, and then hit the comma key to get to the value_if_false.
a. Excel will populate the if function underneath the cell that is being typed in. Select the if
function, just as if this was a brand new if statement that was being started, by double
clicking on the If, or by highlighting it and then hitting the tab key.
b. When this is done, users will notice that the argument below the cell changed from
being in the value_if_false portion of the first IF function to now being the logical_test
of the second if statement.
Tip: Treat this new IF function as its own, free standing if function by entering in all
arguments within the IF function.
5. In the second IF functions logical_test, enter in the second comparison and then hit the comma
key to get into the value_if_true.
6. In the value_if_true portion of the argument, enter in what is to be done if the first logical test is
true, and then hit the comma key to get to the value_if_false.
7. In this example, we are only comparing two values, so in the value_if_false portion, enter in
what is to be performed if neither of the logical_tests are met.
Note: If more logical tests were being compared, another IF function would be entered into the
value_if_false portion, following the same steps that were taken in step 4.
a. When the closed bracket is typed, users will notice that the IF function argument below
the cell will now display the value_if_false argument of the first IF function. Since the
second IF statement has completed the value_if_false portion of the first IF function the
nested if is now complete.
9. To complete the nested IF function, either type in another closed bracket ), or hit the Enter key.
Note: Users may also hit the Enter key after completing the second IF function. If this is done, Excel
will populate a window indicating that there is a typo in the formula, meaning there aren’t any
closed brackets to complete the function. To have Excel enter in the closed brackets, hit the Yes
button.
To verify the nested IF was entered in correctly, click on the cell containing the IF function and then hit
the F2 key. This will display the function with colored cell references related to the cells on the
worksheet.
• Lookup_value – This is the value that is being searched for in the Table_Array.
• Table_array – A table with two or more columns.
To the right is an example of a lookup_table. The lookup value is in the leftmost column, arranged in
ascending order. The return value is the letter grade, which is in column
two.
1. Place the cursor in the cell that is to hold the VLOOKUP function. This will be the cell that will
display the value that will be populated from the table_array.
2. Navigate to the Formula tab and then click on the Insert
Formula icon. The Insert Formula dialog will appear.
3. In the Search for a Formula: text box, type “vlookup” and click
Go.