pre-defined system functions simple if & vlookup

20
Pre-defined System Functions Simple IF & VLOOKUP

Upload: orlando-figgins

Post on 15-Jan-2016

278 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Pre-defined System Functions Simple IF & VLOOKUP

Pre-defined System Functions

Simple IF & VLOOKUP

Page 2: Pre-defined System Functions Simple IF & VLOOKUP

 Why Use Formulas in Excel?

Excel formulas are one of the most useful features of the program. Formulas can be as simple as adding two numbers or can be complex calculations needed for high end business projections. Once you learn the basic format of creating a formula, Excel does all the calculations for you.

Page 3: Pre-defined System Functions Simple IF & VLOOKUP

=If (yourage <= 15, “Box A”,”Box B”)

True Collect something from Box A

False Collect something from Box B

Page 4: Pre-defined System Functions Simple IF & VLOOKUP

If Function

The IF function checks whether a condition is met, and returns one value if TRUE and another value if FALSE.

1. Select cell C2 and enter the following function.

Page 5: Pre-defined System Functions Simple IF & VLOOKUP

Starting the IF function

When you write an IF function in Excel, you always start by typing the equal sign in the cell where you want the answer to appear. Following this, is the IF keyword and the opening round bracket.

Page 6: Pre-defined System Functions Simple IF & VLOOKUP

Parts of the Excel IF function

Inside the round brackets there are three parts or arguments to an IF Function.

The Arguments

1. the logic test - in this example it is A3 > B3

2. the value if true - in this example it is "A is larger"

3. the value if false - in this example it is "B is larger"

Between each argument of the IF function, the comma is used as a separator. The comma is what tells Excel when each argument of IF function ends and the next section begins.

Page 7: Pre-defined System Functions Simple IF & VLOOKUP

Writing the IF Function Logic Test

The logic test is always a comparison between two amounts. In this example we are comparing the values in cells A3 and B3. Between the two values we place a comparison operator. Since we want to know if A3 is greater than B3, we will use the Greater Than operator " > " between the two cell references

Comparison OperatorsThe comparison operators that can be used in the logical test portion of an Excel IF function are:Equals (=) Less than (<) Less than or equal to (<=) Greater than (>) Greater than or equal to (>=) Not equal to (<>)

Page 8: Pre-defined System Functions Simple IF & VLOOKUP

Adding the "Value if True" argument to the IF Function

Following our comma separator, we add in the “value if true” argument of the IF function followed by another comma separator.In this case, if the value in cell A3 is greater than the value in cell B3, we want the function to place a "A is larger" in cell D1.

type "A is larger" followed by a second comma ","

In cell D1 you should see:=IF(A3 > B3,"A is larger",

Page 9: Pre-defined System Functions Simple IF & VLOOKUP

Adding the "Value if False" argument to the IF Function

The last section to add to the IF function is the “value if false" argument of the function followed by the right or closing round bracket.

In this case, if the value in cell A3 is not greater than the value in cell B3, we want the function to place a "B is larger" in cell D1.

For our exampletype "B is larger" followed by a right or closing round bracket ")".In cell D1 you should see the completed IF function:=IF(A3 > B3,"A is larger","B is larger")

Page 10: Pre-defined System Functions Simple IF & VLOOKUP

Copying the IF Function to Other Cells

To complete the worksheet, we need to add the IF function to cells D2, D3, and D4. Since our data is laid out in a regular pattern, we can copy the IF function in cell D1 to the other three cells. As the function copied, Excel will update the cell references to reflect the functions new location.

To copy down our function we will use the Fill Handle.1. Click on cell D12. Place the mouse pointer over the black square in the bottom right corner. The pointer will change to a plus sign " + ".3. Click the left mouse button and drag the fill handle down to cell D4.4. Release the mouse button. Cells D2 - D4 will be filled with the IF function.

Page 11: Pre-defined System Functions Simple IF & VLOOKUP

The VLOOKUP Function

Excel's VLOOKUP Function, which stands for vertical lookup, can be used to look up specific information located in a table of data or database.

VLOOKUP allows you to search a table that is set up vertically. That is, all of the data is set up in columns and each column is responsible for one kind of data. In the Student Record example, there would be a separate column of data for Student Names, one for Student ID numbers, etc.

Page 12: Pre-defined System Functions Simple IF & VLOOKUP

The four comma-separated parameters you can specify for the VLOOKUP function are:

1. Lookup Value: the cell containing the value you’re searching for in your data table

2. Table Array: Excel looks for a match to your Lookup Value within this range of cells

3. Column Index Number: The table column in the same row as the matched cell.

4. Range Lookup: an optional true/false value—set to False to return exact matches only and set to True (or just leave out this parameter entirely) to return the closest match to your lookup value

Page 13: Pre-defined System Functions Simple IF & VLOOKUP
Page 14: Pre-defined System Functions Simple IF & VLOOKUP

The VLOOKUP Dialog Box

Although it is possible to just type the VLOOKUP function into the cell where you want it located, many people find it easier to use the function's dialog box.

Page 15: Pre-defined System Functions Simple IF & VLOOKUP

The Lookup Value Argument

The lookup value is located in the first column of the table of data. After specifying a subject in the first column, VLOOKUP will then allow you to search for specific information located in the same row as the subject.

The lookup value can be text, a logical value (TRUE or FALSE only), a number, or a cell reference to a value.

Page 16: Pre-defined System Functions Simple IF & VLOOKUP

The Table Array Argument

The table array is the table of data that the VLOOKUP searches to find your information.

The table array must contain at least two columns of data. The first column contains the lookup values (see previous step). These values can be text, numbers, or logical values

On this line in the dialog box enter the range of cells where the data is located. It is a good idea to use an absolute cell reference for the table array to avoid possible errors when copying the function.

Page 17: Pre-defined System Functions Simple IF & VLOOKUP

The Column Index Number Argument

The column index number indicates which column of the table array contains the data you are after.

For example:

if you enter a 2 into the column index number, VLOOKUP returns a value from the second column of the table array;

if the column index number is 4, it returns a value from the fourth column of the table array.

Page 18: Pre-defined System Functions Simple IF & VLOOKUP

The Range Lookup Argument

The range lookup value is a logical value (TRUE or FALSE only) that indicates whether you want VLOOKUP to find an exact or an approximate match to the lookup value.

If TRUE or if this argument is omitted, VLOOKUP will use an approximate match if it cannot find an exact match to the lookup value. If an exact match is not found, VLOOKUP uses the next largest lookup value. 

If FALSE, VLOOKUP will only use an exact match to the lookup value. If there are two or more values in the first column of table array that match the lookup value, the first value found is used. If an exact match is not found, an #N/A error is returned.

Page 19: Pre-defined System Functions Simple IF & VLOOKUP

Using the VLOOKUP Function

Page 20: Pre-defined System Functions Simple IF & VLOOKUP

Excel VLOOKUP Error Messages