Sie sind auf Seite 1von 64

# VLOOKUPEXCEL

s September approaches, I can count on a series of spreadsheet questions. One of the popular Excel tutorial requests is how do you look up a value on one Excel worksheet and use it on another Excel worksheet. For example, you need to translate a product number into a product name. One of my favorite Excel functions is the VLOOKUP function and it can help with this task. (Includes Excel VLOOKUP Example file) A recent case involved some voter registration data I needed to analyze. On one Excel spreadsheet, the voters party was listed as an alphanumeric value called "Pcode" and not the political party. This coding wasn't intuitive. For example, D was for American Independent Party, but some thought it meant Democratic Party.

One way to solve this problem is to create a worksheet with the Pcode and translation and have Excel use the VLOOKUP function for the party name. You might think of VLOOKUP as an Excel translator. I could then add a column called Political Party to my original worksheet to show the information from a lookup table.

## Creating a Lookup Table

A lookup table includes the values you wish to "lookup" such as our Pcode and the translation such as political party. You can place this table on the same worksheet, but for this Excel tutorial I'll add a worksheet called "Political Party". How to Create a Lookup Table, 1. Right-click your spreadsheets tab and select Insert 2. On the Insert dialog, double-click Worksheet. This will be on the General tab. 3. Rename this new worksheet tab with a descriptive name such as Party Codes 4. In Column A, enter the unique values that exist on your main worksheet. In my example, these were the codes that showed in the Pcode column in the thumbnail. These values should be in ascending order.

5. In Column B, enter the translated value. You can have more values in column A than appear on your main spreadsheet. For example, I have an entry for Citizen Party even though I didnt show a registered voter with that affiliation.

## Using the VLOOKUP Function

Excels VLOOKUP function uses 4 pieces of information. The function panel may seem intimidating with the terms, but its simpler than it looks. To lookup a value using VLOOKUP, 1. Add your new column on your original worksheet that will display the info pulled from the Lookup table. In my example, I added a column called Political Party in Column D. This is where I will insert the Excel function.

2. Place your cursor in the first blank cell in that column. In my example, this is cell D2. 3. From the Insert menu, select Function. The Insert Function dialog will appear.

4. In the Search for a function: text box, type vlookup and click Go. 5. Highlight VLOOKUP and click OK.

## Defining the VLOOKUP Values

After you click OK, Excels Function Arguments dialog appears and allows you to define the four values. Youll see that your starting cell and the formula bar show the beginning part of the function =VLOOKUP(). The Function Arguments dialog adds the needed data elements that will display between (). For illustration purposes, I have overlaid the Party Codes worksheet on top to show the relationships.

1. Lookup_value Think of this field as your starting point. In my example, Ill click cell C2 so the value is filled in the dialog. I'm requesting Excel take the value of C2, which displays as the Pcode of A, and find the matching political party on my lookup table on the Party Codes worksheet. 2. Table_array This is the range for your lookup table. The range can be on your existing worksheet or another worksheet such as our Party Codes. When you click another tab and define the range, Excel prepends that tab name to the range such as Party Codes.

## Rules & Caveats

There are several rules to remember about this table array. Rule 1 - The left column must contain the values being referenced. In other words, I couldnt have our first column be Political Party. Rule 2 - You cant have duplicate values in the leftmost column of the lookup range. I couldnt have two entries with the value A with one being Democratic party and another A for the Humanist party. Excel would complain. Rule 3 - When referencing a lookup table, you dont want your cell references to change when you drag and fill to populate the other cells with the VLOOKUP function. As example, if I want to use the same function in cells D3 through D7, I dont want my lookup cell references to shift each time I move down to the next cell. I need the cell references to be the same. After you define your range, you need to press F4 which will cycle through absolute and relative
4

references. You want to select the option that includes a \$ before your Column and Row. ( 'Party Codes'!\$A\$2:\$B\$45. ) You can get around this if you know how to use Excel name ranges. Col_index_num This is the number of the column on your lookup table that has the information you need. In our example, we want column 2 from the Party Codes worksheet which has the name of the political party. Range-lookup this field defines how close a match should exist between your Lookup_value (C2) and the value in the leftmost column on our lookup table. In our case, we want an exact match so well use FALSE. After clicking various cells, my dialog looks like this:

You can see in the circled formula bar above, I now have more information based on my entries in the Function Arguments dialog box. The other item of interest is that when you build these functions, Excel displays the result in the Formula result = text line. This is great feedback which can show if your function is on target. In our example, we can see Excel looked up the Pcode of A and returned the Political Party Democratic.

## Copying the VLOOKUP Function to Other Cells

It doesnt make sense to use VLOOKUP for one cell in your Excel spreadsheet. Instead, I want to copy the function to other cells in the same column. To copy VLOOKUP to other column cells, 1. Click the cell containing the VLOOKUP arguments. In our example, this would be D2. 2. Grab the cell handle that displays in the lower right corner. 3. Left-click and drag down the cell handle to cover your column range.
5

Note: If I hadnt changed to absolute reference as mentioned in Rule 3, I wouldve seen my table array entry shift by one cell as we dragged down through the other cells. VLOOKUP is a powerful Excel function that can leverage spreadsheet data from other sources. There are many ways you can benefit from this function. In this example, I used a 1:1 code translation, but you could also use it for group assignments. For example, you could assign state codes to a region such as CT, VT, and MA to a region called New England. And for the adventurous, you can use VLOOKUP in your Excel formulas.

If you use Excel much at your job, sooner or later, youre bound to need to look up values in a table. One of the most useful functions in Excel, called vlookup, does exactly that. The V in vlookup stands for vertical and lookup is pretty self explanatory. This function allows you to look up values in a table that are listed in column format (how most tables are laid out), given another value (lets call this the key). Excel also has a sister function called hlookup (h = horizontal) that can be used to look up values in rows. Sadly, as most companies seem to rely on Excel as a poor-mans database of sorts (a totally unscalable solution and prone to errors with every revision, but dont get me started), once you know vlookup, its likely to become one of your most often used Excel functions. So, lets get started with a very simple example of what vlookup is all about. Suppose you had the following table:

Given a list of names in another part of the table (in this case, column H), you want to figure out what kind of animal it is:

Vlookups format looks like the following: =vlookup(lookup value, table where values reside, column # where values are located, false) Lets look at each of these parts a bit closer. The first thing that goes into the vlookup function is the thing you know (or are given) and that will be used to lookup other values. In this case, you have the names of the animals, so these are the things we know. In our example, they reside in column H, from cells H2 through H5. If we wanted to put the type of animal next to the name of the animal in column I (so I2 would correspond to the name of the animal in H2), we would insert the vlookup function there:

## and put H2 as the first thing in our vlookup function:

Next, we need to know the location of the table where our values reside. These happen to be from cells A1 through B5 in this example, which we would highlight with our mouse to insert into the vlookup function. Its very important that you include all the cells in the table. Highlight the table with your mouse:

At the same time, the vlookup function automatically puts in the cells youve highlighted:

Next, we need the column number where the values are located. Always start with the first column (column A in this case) as #1 and count out to the right. In this example, the type of animal listed is in column 2, so thats what we would need to insert in the vlookup function. Note

that to use vlookup, your keys always have to be to the left of your values. (Well cover more of this in part II of the tutorial at a later date.)

Finally, the last attribute that vlookup takes is either true or false. I happen to always use false, and what this does is force vlookup to return the first exact value it finds. If that value isnt found, then vlookup conks out and returns #N/A. Though we wont use it in this example, if you select true, then rather than always looking for the exact value, vlookup will return the exact value if it exists, or the closest one to it that doesnt exceed the key. (If you use true, you will need to sort your data in ascending order before using vlookup.)

Still with me? Again, this is what we would actually put in cells I2 if the names of the animals we have are located in cells H2 through H5: =vlookup(H2, A1:B5, 2, false) Once we close off the parenthesis and hit Enter, vlookup automatically calculates:

And so on. We would continue down each cell in column I that we needed. One thing to note is to make sure that the location of your keys and values is always selected correctly. Oftentimes, as you copy-and-paste formulas all around Excel, the location of the data will also move around relative to the cell. The easiest way to prevent this is to lock the range of the location; in this case, we would do so by using \$A\$1:\$B\$5 instead of A1:B5. This way, as we move down column I, say, to cell I2, A1:B5 doesnt become A2:B6 but stays with the original range of data. This way, we can just copy whats in cell I2 down the rest of the cells (from I3 through I5):

Finally, heres our result, after making the \$ changes and copying and pasting the formula down the rest of the column:

10

This has been a really simple example of vlookup, and Ill cover a bit more in part II with another example, still simple, but with slightly more data. Although in practice, vlookup is usually used between Excel sheets and workbooks, once you understand this example (which has been done within a single sheet), using vlookup outside the same sheet shouldnt be much harder. Look for part II soon! Popularity: 27% [?]

## MS Excel: VLookup Function

11

In Excel, the VLookup function searches for value in the left-most column of table_array and returns the value in the same row based on the index_number. The syntax for the VLookup function is: VLookup( value, table_array, index_number, not_exact_match ) value is the value to search for in the first column of the table_array. table_array is two or more columns of data that is sorted in ascending order. index_number is the column number in table_array from which the matching value must be returned. The first column is 1. not_exact_match determines if you are looking for an exact match based on value. Enter FALSE to find an exact match. Enter TRUE to find an approximate match, which means that if an exact match if not found, then the VLookup function will look for the next largest value that is less than value.

Note: If index_number is less than 1, the VLookup function will return #VALUE!. If index_number is greater than the number of columns in table_array, the VLookup function will return #REF!. If you enter FALSE for the not_exact_match parameter and no exact match is found, then the VLookup function will return #N/A.

Applies To:

## For example: Let's take a look at an example:

12

Based on the Excel spreadsheet above: =VLookup(10251, A1:B21, 2, FALSE) =VLookup(10251, A1:C21, 3, FALSE) =VLookup(10248, A1:B21, 2, FALSE) =VLookup(10248, A1:B21, 2, TRUE) would return "Tofu" would return \$18.60 would return #N/A would return "Queso Cabrales"

Question: In Excel, I'm using the VLookup function to return a value. I want to sum the results of the VLookup, but I can't because the VLookup returns a #N/A error if no match is found. How can I sum the results when there are instances of #N/A in it? Answer: To perform mathematical operations on your VLookup results, you need to replace the #N/A error with a 0 value (or something similar). This can be done with a formula that utilizes a combination of the VLookup function, IF function, and ISNA function.

13

Based on the spreadsheet above: would =IF(ISNA(VLOOKUP(E2,\$A\$2:\$C\$5,3,FALSE)),0,VLOOKUP(E2,\$A\$2:\$C\$5,3,FALS return E)) 0 First, you need to enter a FALSE in the last parameter of the VLookup function. This will ensure that the VLookup will test for an exact match. If the VLookup function does not find an exact match, it will return the #N/A error. By using the IF and ISNA functions, you can return the Unit Price value if an exact match is found. Otherwise, a 0 value is returned. This allows you to perform mathematical operations on your VLookup results.

Question: I have a list of #s in column A (lets say 1-20). There is a master list in another column that may not include some of the column A #s. I want a formula in column B to say (if A1 exists in the master list, then "Yes", "No"). Is this possible? Answer: This can be done with a formula that utilizes a combination of the VLookup function, IF function, and ISNA function.

14

Based on the spreadsheet above: would =IF(ISNA(VLOOKUP(A2,\$D\$2:\$D\$185,1,FALSE)),"No","Yes") return "No" would =IF(ISNA(VLOOKUP(A5,\$D\$2:\$D\$185,1,FALSE)),"No","Yes") return "Yes" First, you need to enter a FALSE in the last parameter of the VLookup function. This will ensure that the VLookup will test for an exact match. If the VLookup function does not find an exact match, it will return the #N/A error. By using the IF and ISNA functions, you can return a "Yes" value if an exact match is found. Otherwise, a "No" value is returned.

Question: Is there a simple way in Excel to VLookup the second match in a column? So, for instance, If I had apple, pear, apple listed in the column (each word in a separate cell), would there be a way to look up the values to the right of the second "apple"? Answer: This can be done with a formula that utilizes a combination of the Index function, Small function, Row function (all in an array formula).

15

If you wanted to return the quantity value for the second occurrence of apple, you would use the following array formula: =INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),2),2) When creating your array formula, you need to use Ctrl+Shift+Enter instead of Enter. This creates {} brackets around your formula as follows: {=INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),2),2)}

If you wanted to return the quantity value for the third occurrence of apple, you would use the following array formula: =INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),3),2) When creating your array formula, you need to use Ctrl+Shift+Enter instead of Enter. This creates {} brackets around your formula as follows: {=INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),3),2)}

If you wanted to return the bin # for the second occurrence of apple, you would use the following array formula: =INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),2),3)
16

When creating your array formula, you need to use Ctrl+Shift+Enter instead of Enter. This creates {} brackets around your formula as follows: {=INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),2),3)}

If you wanted to return the bin # for the third occurrence of apple, you would use the following array formula: =INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),3),3) When creating your array formula, you need to use Ctrl+Shift+Enter instead of Enter. This creates {} brackets around your formula as follows: {=INDEX(A2:C6,SMALL(IF(A2:C6="apple",ROW(A2:C6)-ROW(A2)+1,ROW(C6)+1),3),3)}

17

In our last example, we had a simple, two-column list of names and types of animals. In this post, well take a look at a list of employee names and data, say, for calculating commissions for sales people. Heres what our data looks like (on all images in this post, click to enlarge):

As you can see, were given employees last and first names, their base salaries, their bonus percentage, and the % of the year that they were employees. Were also given a unique identifier in the form of an employee number. Lets examine the data a bit further.
18

First, what we should notice is that there are employees with the same last and first names. Theres an Andrew Anderson as well as an Andrew Cobb. And a Penny and Jim Dee. Remember that VLOOKUP will either return the first match it finds in a list. In this case, if we were to use VLOOKUP to lookup a list of last names or first names, VLOOKUP would always return Andrew Andersons data (if we were looking using the First Name field) or Pennys data (if we were looking using the Last Name field). So, what to do? In this example, were lucky to have a unique identifier in the form of Employee Number. Each number is assigned only once to the employee, so this field would be a safe one to use for VLOOKUP. The only problem is that its located all the way at the end of the data, to the right of all the other fields. Remember that VLOOKUP has another criteria: whatever field youre using to look up other data has to be to the left of all the other fields. The easiest way to accomplish this is to insert a column to the left of Last Name (Column A) and copy-and-paste the Employee Number column there. Heres how that would look, step by step: Step 1: Select column F, where Employee Number data is located:

19

20

21

22

23

24

## Step 6: Select Insert Copied Cells on the menu

25

Step 7: The cells from column F are now copied over to column A, and everything is shifted over one column:

26

Now, employee numbers appear in both column A and G. Hit to get rid of the highlight around column G.

27

Were now good to go! By the way, if you had not had unique identifiers like employee numbers readily available, you could potentially use the CONCATENATE or & function in Excel to create unique identifiers. CONCATENATE is a function that just munges two fields together. In this case, creating a unique identifier out of concatenating last name and first name would probably work.

28

Back to the tutorial. Suppose we had a second sheet that had a list of employee numbers for the four employees who had worked less than 100% during the year, and we wanted to calculate their bonuses for the year. Notice we swapped first and last name orders in this sheet and put the employee numbers in a different order:

We just want to fill in the data from the other source (possibly from another Excel sheet or workbook) in order to do the calculation. Here, Ive left the original data in Sheet1 and am pulling the data into Sheet2.
29

What would we put into cell B2 in order to pull the data correctly? In the example in the last post, we only had two columns of data. In this example, we have seven, after copying over the employee numbers into the first column. For the First Name column, we would be pulling data from column 3 in our data set (not column 2, which contains last names). So heres what the VLOOKUP would look like for cell B2: =VLOOKUP(A2,Sheet1!A1:G8,3,FALSE) And heres the excel step-by-step: Step 1: Insert the VLOOKUP function by typing =vlookup( in cell B2:

30

Step 2: Were looking up Employee Numbers, which are located in the previous column, so we put in A2 for cell B2:

31

Put in a , after this to move on to the next input for VLOOKUP called table_array. Step 3: Now we need to highlight the area where all the data resides:

32

Put in a , after this to move on to the next input for VLOOKUP, called col_index_num. Step 4: Remember that in this case, we need to reference column #3, where first names are located. We always start with the lookup value as column #1 and count toward the right.

33

Put in a , after this to move on to the final input for VLOOKUP. Step 5: Finally, we want to put in false as the final input into VLOOKUP to tell it to look for exact matches.

34

Now close off the parenthesis to VLOOKUP, and the cell is automatically populated with the data we need.

35

The key now is to populate the rest of the cells. Can you figure out how to do this? One way would be to go through each cell and repeat the steps above. For example, to populate cell C2, we would write: =VLOOKUP(A2,Sheet1!A1:G8,2,FALSE)

36

and so on, referencing each column where the data resides. (Salary resides in column 4, bonus in column 5, etc.) Another way would be to use Excels anchoring mechanism so that we could copy and paste formulas a bit more efficiently. For example, for the rest of the cells under First Name, what we could do is write the following instead in B2: =VLOOKUP(\$A2,Sheet1!\$A\$1:\$G\$8,3,FALSE) What putting a \$ sign does in front of cell coordinates is to lock them in place. By putting \$A2 instead of A2 in the first input section, we lock A in place (because all our employee numbers are in column A) and let the 2 change as we go down the row. By putting \$A\$1:\$G\$8 instead of A1:G8 as we originally had, we lock in the entire A1 to G8 cells in place and keep that section locked no matter where we put the formula. If we then copy the formula down to cells B3 through B5, we dont have to retype the formula each time. Similarly, you can copy the formula across each row, making sure to just change each column number so that youre pulling the right data. Heres what the finished table would look like:

37

And heres what the final column, which is just the total bonus calculation, would look like if we assumed that bonuses equaled salary * bonus * % of year worked:

38

In this example, we populated a new table in a new sheet with data from a separate sheet. But keep in mind one of the powerful things of VLOOKUP is that with a unique identifier such as Employee Number, what we could do is create an entirely new table with elements from multiple other tables that each contain Employee Number. For example, salary information might be stored in one place, and employee names in another. By using VLOOKUP to lookup employee numbers from each table, we could create one table that contains all information at once.
39

This has been a pretty lengthy example thats actually covered a lot of different Excel tips, so well stop here. If you have any specific questions or examples that you wouldnt mind sharing (of course, all data would be disguised and Id get your permission first), Id be happy to answer them by creating a post with your example in the center. Popularity: 8% [?]

40

One of the questions that we have been receiving quite a bit in recent months has been regarding the difference between the Sumif and Vlookup functions in excel. They are fairly different but there is some confusion regarding their use. Lets start off by explaining both: -Sumif function: Is used to sum the quantity (or any other data in a separate column) for a specific criteria. We already wrote about this function, you can find out more about the sumif and countif functions -Vlookup function: Is used to find a reference associated to a specific criteria

These are the formulas used: =SUMIF(A:A,Strawberry,B:B) =VLOOKUP(Strawberry,A:B,2,FALSE) When do you use each one? Vlookup -If you only have one sample for each fruit -If the data you are looking for is not a number -If you want to easily spot a missing fruit vlookup will give you a N/A result when a vlookup returns no results

41

Sumif -If you have more than one sample -If you want to avoid getting N/A errors that will screw up calculations in your spreadsheet Does that explain it well enough? Popularity: 1% [?]

## What Is An Excel Macro? difference with functions

42

On this blog, we have written quite a bit of material that concerns excel functions such as vlookup, sumif, and even combinations of functions such as nested functions (if and or functions combined together). When you start getting a good knowledge of these functions and how to use them, you start to feel as if excel is incredibly powerful and it is. The possibilities are almost endless. That being said, functions are only a small part of the story. If you work on excel and use functions, you are tapping into a bigger part of excel than most users. However, there a lot more ground to cover. Excel macros can range from the easiest operation that you could have easily performed with functions but can also include interacting with other files, other windows applications, complex operations with variables, etc. Basically, any task that you perform in excel can be replicated with excel macros. Sounds powerful? It truly is. -What Does It Look Like In Excel? When you add functions to a spreadhseet, it is very obvious . One big difference when building Excel Macros is that when you look at the spreadsheet, you will not necessarily know that some macros exist in the spreadsheet. There are a few ways that you can find out. First off, users often insert buttons on their spreadsheets that make it easier to start macros, here is an example:

## Another way to see is to look through the menu:

43

44

Finally, if while you are in the excel sheet you press on: ALT+F11, this will give you a better view of the document. You can see some of what is going on in the background. Macros are usually found in modules, that are attached or part of the excel document but they could be found in the background of the sheets themselves. Here is a small view of the structure of my document.

45

-What Are Some Of The Possible Ways To Use Them? There are a million (or more) different ways that macros can be used and I think there are many reasons why you would use macros. Some of the possible uses are more complex rules that would be difficult to replicate, combination of different excel fonctions, advanced usage of utilities such as filters, but also trying to either get data from external spreadsheets, saving data to other drives, etc. We will be going through some of the things that can be done over the next few weeks and hopefully you will also be asking any questions that you might have regarding the use of macros. -Why Use Macros? What Are The Benefits? Macros are obviously not perfect but they do offer many advantages. -Executing complex operations that would not be possible with regular functions or would require a lot of time. -Clean Spreadsheet: Since macros are built in the background, once they are done, it becomes much easier to run without fearing of erasing a function, etc. It is also very easy for outsiders to use the macros.
46

-Speed: Running macros can make complex operations that take hours for a regular individual be done -Easy to improve/modify: Well written code can become very easy to modify and improve which is not necessarily the case in heave spreadsheets -Excel Macro Downsides Honestly, there are few downsides to using macros, one of them would of course be that they take more to build, especially when you are a beginner. As well, it can be more difficult for a user to understand how the spreadsheet and macro is reacting compared to a more standard and simple spreadsheet. Other than that, I honestly cannot think of big downsides. -Next Week In our next post, we will take a look at how to build your first macro, how it should be done and well go from there! Popularity: 1% [?]

47

I have to say that Im thrilled because we are receiving quite a few questions these days both in comments and by email. As always, we are more than happy to help and in most cases, the answer can help quite a few others so we publish the answer as a new post. Wed be very happy to receive questions from you so be sure to contact us with any problems that you have. Today, we received the following question, which initially appeared as a comment on our excel nested if statements tutorial. Ive translated the question to make it easier to understand here: I am just trying to get a Y or N when applying this formula: =IF(OR(U2>=500,U2<=-500),IF(OR(V2>=10%,V2<=-10%),Y,N)) Below are a couple of sets of data and the results that I got when the formula was applied:

As you can see, once the data does not meet the first part of the formula, it gives you a FALSE. If it meets the first part but does not meet the second, it gives you an N. If it meets both parts, it gives you a Y. I only want the formula to produce 2 results, Y or N. Let me know if you have any further questions. Otherwise, let me know if you can help me solve this problem. There are a few different things to discuss here. First off, lets translate this into an easier question to understand. Lets imagine the question is. I want to determine small or large schools that have very poor or very good results. A small school would have less than 450 students, a large one over 550, and very poor results are under 50% while a very good one is over 70%. So what am I looking for? Schools that have under 450 or over 550 students that have a score under 50% or over 70% The first thing that I notice in the statement is that it is incomplete: =IF(OR(U2>=500,U2<=-500),IF(OR(V2>=10%,V2<=-10%),Y,N)) This statement initially does one thing. It checks if U2 is greater or equal to 500 or smaller or equal (of course, any number will fit this condition). If that condition is met, it checks for the 2nd part, which is similar. The problem of course is that it does not give any indication for what happens if the first condition is not met. I would thus start by changing the statement to: =IF(OR(U2>=500,U2<=-500),IF(OR(V2>=10%,V2<=-10%),Y,N),N) This fixes the problem of getting a False, see the new result:

48

In order to add the conditions that I discussed, I would change it to: =IF(OR(U2>550,U2<450),IF(OR(V2>70%,V2<=50%),Y,N),N) By changing the set, you can see the result:

Hopefully this helps. Its important to always structure your arguments to not miss any parts. Doing one condition at a time is a great way to do get it done. We look forward to getting more questions from you! Popularity: 1% [?] Posted on 30 June 11 by Leslie 1 Comment | Permalink

Using Excels future value (fv) function to make a case for ETFs
Excel function tutorials
In recent months, we have often had discussions about ETFs and they are gaining a lot of traction all around the world as a better way to manage finances. There are many differences between ETFs and more traditional mutual funds but by far the most important one is the difference in fees for the investor. The most important fee when discussing long term investments is without any doubt the MER, the management fees that will be charged to the investor every year until he decides to get out of the investment. ETFs usually charge a fee between 0.05% and 1% while mutual funds typically charge between 1-3%. Its probably say to say that the average difference between the two is close to 1.50% in annual fees. Is It That Simple? Not quite no as another difference between the two is the fees that are charged when entering and exiting your position. Since ETFs are traded on an exchange, investors end up paying commissions while for mutual funds it is a bit more complex as some funds charge for entry, exit
49

and those fees can depend on the length of the investment among many other criteria. I would however say that in general the entry fee might be more important on mutual funds. Is it significant? Not if you end up paying less every year for a decade, two or even more. While the difference will vary quite a bit from one investor to another, I think its fair to assume that in general an investor using ETFs over mutual funds will end up saving 1% or so on average per year. Is 1% That Much Of A Difference? I hear the question loud and clear but I think that instead of discussing the importance of fees over time, their effect on the compound return, I thought I would do an example in excel. I will paste the detailed tables to start off and then the much more simple use of the future value function. Lets start with assumptions. Judy has \$100,000 in investments, expects to generate 6% per year, will invest \$12,000 per year and will retire 35 years from now. How much money does she expect to have by then? Here is a simplified spreadsheet:

50

Over \$2.1 million! Impressive isnt it? Now lets assume she could keep the same return with ETFs but save 1% annually on fees, here is the result:

51

Over \$2.7 million, a difference of over \$600,000!!! That is an incredible difference and is a great example of why those 1% of fees matter a lot more than you could possibly imagine. I dont think I need to go much deeper into the reasons why but i did want to show off a much easier way to compare the two by using Excels Future Value (FV) function. Its easy, much cleaner and easier to play around. Here is an example of the same comparison using the FV function:

52

Only the two last lines have formulas as they use the FV function. The formula in B7 is: B7: = FV(B3,B5,-B2,-B1) And I calculated the same with an added 1% of return by doing the following: B9: = FV(B3+0.01,B5,-B2,-B1) Popularity: 1% [?] Posted on 08 June 11 by Leslie Comment | Permalink

## Using ranges in excel if conditions

Excel function tutorials
Good morning and welcome to another one of our excel tutorials. This time we are answering to a common question that we get which concerns using ranges in conditions. Here is the question: If marks is 40-60 text should be PASS if it is more than 60 & less than 75 First Class , If more than 75 Disti. It looks like a simple task but as many of you know, it is much more tricky than you would initially imagine. To make things a bit more complex, here is the range we will decide for our student grades: 0-49%: Fail 50-59%: Pass 60-75%: First Class 76%-100%: Distinction

53

As is always the case in excel, there are many different ways to get this done but we will try a few here, let`s start by getting a sample of students. Obviously, the goal is to make it as easy to correct 10, or 250 students!

There are many different ways to get it done but in this case we will simply be using conditions. It will look like a difficult one but you simply need to be disciplined when you write it. Doing it by steps Step #1-If the student got under 50% = fail =IF(B2<0.5,"Fail","Pass") Step #2-If the student got under 50% = fail, if he got under 60%, he passed =IF(B2<0.5,"Fail",IF(B2<0.6,"Pass","Good")) Step #3-If the student got under 50% = fail, if he got under 76%, he got First Class. If none of those conditions are filled, he got a Distinction =IF(B2<0.5,"Fail",IF(B2<0.6,"Pass",IF(B2<0.76,"First Class","Distinction"))) What you are doing is simply adding a condition. Step by step, you are looking at: -Did the student fail? -If he did not fail, did he get under 60%? -If he did get it 60%, did he get 76%? It looks like a difficult argument to build but if you do it one step at a time, it actually works very well. Please note that you must do these in order.

54

As is always the case, wed love to get your comments or questions! Thanks in advance! Popularity: 1% [?] Posted on 18 May 11 by Leslie 2 Comments | Permalink

## How to manage excel errors with the iserror function

Excel function tutorials
Its a common problem but one that often seems difficult to manage. Last week, we discussed the use of iserror when doing multiple conditions and that certainly seemed to be of interest. Unfortunately, excel is not very good at managing errors. Try to do a vlookup on a value that excel cannot find and not only will you be unable to do anything with that cell but any reference to that cell will turn out as an error as well. It can become very frustrating and can make things very difficult to manage. While its not always the case, I personally usually prefer when excel can keep the calculation and the spreadsheet working while possibly giving me notice of the error at the same time. A challenge? Not necessarily. Today I will discuss the use of the iserror function and how you can use it to keep things working while still seeing that there are possible issues. First off, lets take a look at a possible spreadsheet that would require the use of the iserror function Imagine a company that has a sales team. For each of these sales people, they give a different commission rate. At the end of the month, they would want to easily know how much sales were made and how much commission should be paid out. However, using the vlookup function would generate errors each time a new sales person is added. While its practical to have a

55

notice, its not always ideal to have to correct all of those before getting an estimate, especially in a big company. Take a look at the following spreadsheet

What could be done? One possibility would be adding the missing sales team members on the left and we can all agree that it will need to be done at some point. However, a short term solution could be setting a estimate of 7% commission for missing members. How to do it? Instead of using the straight vlookup such as: =VLOOKUP(D2,A:B,2,FALSE)*E2 I will use an iserror such as: =IF(ISERROR(VLOOKUP(D2,A:B,2,FALSE)*E2),7.5%*E2,VLOOKUP(D2,A:B,2,FALSE)*E 2)
56

## What will it look now?

Much cleaner right? And it gives a decent estimate of the commissions to be paid out. The problem of course now is to find those errors. How to do it? I would personally create a column just on the right to detect errors by doing the following: =IF(ISERROR(VLOOKUP(D2,A:B,2,FALSE)*E2),MISSING,")

57

58

59

60

## How to use multiple conditions in excel

Excel function tutorials

The question seems complex but if you read it carefully, this is simply a case of using multiple conditions. What do I mean? For each product, we are attempting to find if at least one of the buyers is External. As in any other problem, there are many different ways to resolve this. I will go ahead and show you how I would resolve it. Step #1 Determine who the Internal Buyers are: I will simply set up the name of those buyers and will then be able to reference them. So here we go:

61

Step #2 For each product, determine if the buyers are external or not. In this case, what I am looking for is confirmation that at least one buyer is external. How will I do this? Simply by using a vlookup. If the vlookup result is false (the name is not on the list) and there is one buyer, it means that the buyer is external. How am I doing it? Simply by adding a column. I could add one column per Co.A so 4 columns but in this situation, I simply need to verify if at least one of them is external. So here we go:

The formula in H2 is: =IF(B2<>",IF(ISERROR(VLOOKUP(B2,J:K,2,FALSE)),1,VLOOKUP(B2,J:K,2,FALSE)),0) Which means: If Co.A has a buy (is not empty), look in the column j. If you find it, great, put 0. However if you do not find it (and have an error), please put 1 instead of the error. In this way, I can easily tell that for both Apple and Banana, the buyer from Co. A is external. I will simply do the same thing for the 4 Co. The result in cell H2 is: =IF(B2<>",IF(ISERROR(VLOOKUP(B2,J:K,2,FALSE)),1,VLOOKUP(B2,J:K,2,FALSE)),0)+ IF(C2<>",IF(ISERROR(VLOOKUP(C2,J:K,2,FALSE)),1,VLOOKUP(C2,J:K,2,FALSE)),0)+I F(D2<>",IF(ISERROR(VLOOKUP(D2,J:K,2,FALSE)),1,VLOOKUP(D2,J:K,2,FALSE)),0)+I F(E2<>",IF(ISERROR(VLOOKUP(E2,J:K,2,FALSE)),1,VLOOKUP(E2,J:K,2,FALSE)),0)

62

It seems much more complicated than it really is. And basically, from here, I can easily tell that the Apple, Banana, Grapes and Peach have at least one external buyer. Step #3 Use simple conditions in Result 1 and Result 2 columns I will simply replace those 2 columns by formulas: For result1, I have: =IF(H2=0,X,") For result2, I have: =IF(H2=0,",X) Thats it! Not complicated and flexible to change depending on your needs. You can download the spreadsheet used here! Popularity: 1% [?]

63

64