Download presentation
Presentation is loading. Please wait.
1
Assignment for CPTE 100 Dr. John Beckett
VLOOKUP Assignment for CPTE 100 Dr. John Beckett
2
Agenda Pre-Requisites Theory How to use VLOOKUP in Excel
Example of actually using VLOOKUP The Assignment
3
Can I Do This? We presume you’ve worked with spreadsheets in the past, and understand they are a way of handling information in a tabular fashion. This assignment takes you another step: Using reference information to complete entries
4
What is Reference Information?
When you buy an item at a store, nobody has to enter the description and price. The bar code is scanned in, and that number is looked up in a central database. The Data Base contributes the description and price! Central computer With Data Base
5
Another Example When you charge a purpose on a bank card:
The cash register sends your account number and the purchase total to the bank’s computer The bank’s computer responds with “authorized” if ok The bank’s computer responds with “authorized” if ok Bank Card Computer
6
Taking References to the Next Level
The items data base table may contain a code for the vendor A second table would then be used to get the vendor name UPC Name Vend ID Price Nutty Bars 452 99 Oatmeal Cream Pie Twinkies 381 109 Orange Cupcakes 129 Vend ID Vendor Name 452 McKee Foods 381 Hostess This process of using a second table to avoid duplicated (wasteful and possibly erroneous) data is called normalization. This is an example of how apparent complexity can actually save work in computer systems. Yes, I know Hostess went out of business but this example was too tasty not to use. And if you only use it for homework, it has no calories!
7
Excel’s VLOOKUP Function
Excel has a reference function: VLOOKUP VLOOKUP uses an argument such as a stock number or any other unique identifier, and look up other information about that item The source of reference information can be: A table on the current worksheet A table on another sheet in the same Excel document An exernal data source such as a data base server An “argument” is simply information you give a function so it knows what you are asking it to do.
8
Using VLOOKUP Establish a data source
We’ll use a separate “sheet” in the spreadsheet Place an expression using VLOOKUP in the cell where we want the data to appear =VLOOKUP(value, table_array, col_index_num, FALSE) value is what we’re looking up (e.g. UPC code) table_array is where the data is located col_index is which column has the data we want to use
9
A VLOOKUP Example – 1 Our Excel file will have three sheets.
This is the Invoice sheet, which at the moment has only UPCs and quantities entered. In case you haven’t encountered this: An Excel document may contain several “sheets” selected by clicking the sheet name at the bottom.
10
A VLOOKUP Example - 2 Here is the Products sheet
In real life this would have an entry for every product we sell This is the Vendors sheet
11
A VLOOKUP Example - 3 By entering an expression including VLOOKUP as shown, we can make Excel look up the product name automatically But…if we use a relative range, it doesn’t work if we copy the formula
12
A VLOOKUP Example - 4 With an absolute range selected, however, all the products come out right! Note that we selected column 2 of the range to get the product name
13
A VLOOKUP Example - 5 We can use the same method to pull in the price, which is in the fourth column of the product table Then we can use simple formulas to get the row and grand totals
14
A VLOOKUP Example - 6 Now we pull in vendor information
I started by picking up the vendor ID Note that I’m still using an absolute range That worked just fine, but how to get the vendor name?
15
A VLOOKUP Example - 7 I created another VLOOKUP, but the first argument for this VLOOKUP call is the entire formula I used to pull up the vendor ID But..I want to use the vendor ID, so that makes sense!
16
A VLOOKUP Example - 8 Copying that formula down the page completes the task
17
How to Do This Assignment
Work through the example I just gave you, to make sure you can get it to work Start with a blank Excel document Analyze the assignment to see where it is similar and where it is different compared to the example. Now you are ready to do the assignment! This is a method that will help you in all sorts of computer tasks!
18
Notes about the Assignment
You don’t want to type in over 40,000 zip code entries, so I’ve provided you a data file Note that this data file is as of 2007 so it might not have every zip code you might try, and some of them change (e.g split a few decades ago into and 20912)
19
Importing a Data File – 1 I downloaded ZIPCodes.txt to my desktop
Now I open it in Excel But..it doesn’t show, so I have to select “All Files” in the Open dialog
20
Importing a Data File – 2 This isn’t an Excel file (.xsls), but Excel suspects it is a data file created by another program. Indeed it is! Accept Excel’s guess that it is a “delimited” file That means the data items are separated by a character
21
Importing a Data File - 3 Next Excel tries to guess what character is the delimiter Oops: Excel gets it wrong! Looking at the data, we can see it’s a comma. So select the comma and click Next.
22
Importing a Data File - 3 Excel tries to figure out what sort of data is in those columns. “General” will work for this simple assignment, so click Finish
23
Importing a Data File - 4 We just saved typing 42,192 lines of data!
Right-click the “Sheet1” tab at the bottom, select Rename, and give it the name “ZipCodes” Click the “+” sign at the bottom, and you’re ready for the next sheet.
24
Importing a Data File - 5 With “Sheet1” active:
Select “Data” from the menu at the top Click “From Text” in the “Get External Data” menu Select “States.txt” and proceed as before
25
Continuing the Assignment
Click the “+” again at the bottom, and rename this sheet “Data” Enter information from the assignment Set up formulas so that the addresses will automatically pick up city and state using VLOOKUP Our TAs will be specifically looking to see that you did it this way and the assignment is worth ZERO if you simply typed in the answers!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.