Академический Документы
Профессиональный Документы
Культура Документы
html
VLOOKUP Video
Watch the steps for creating this formula in the Product Price VLOOKUP video, show below. The written instructions are
below the video.
Note: To make it easier to refer to the table, you can name the range. There are instructions here: Naming a Range
Once you have created the lookup table, you can create other formulas in the workbook, and pull information from the
product list. For example, to prepare an invoice, you can enter a product code, and formulas will get the product name or
price from the product table.
In this example, the invoice is created on a sheet named Invoice. The VLOOKUP formula should find an exact match for
the product code, and return the product name.
To create the VLOOKUP formula that calculates the product price, follow these steps:
Note: To return the product price, create a VLOOKUP formula that refers to column 3 of the lookup table. For example,
enter the following formula in cell C7:
=VLOOKUP(A7,Products!$A$2:$C$5,3,FALSE)
To view the steps for creating this formula, please watch the VLOOKUP video shown below. The written instructions are
below the video.
In this example, the lookup table is created on a sheet named Grades. To create the lookup table, enter the minimum
score for each grade in column A. Enter the matching Grade in column B. Sort the Scores in Ascending order.
Cells A2:B6 were named GradeList.
The scores are entered on a sheet named Report Card, where a VLOOKUP formula calculates the grade.
1. On the Report Card sheet, in cell B4, enter the score 77.
2. In cell C4, enter the VLOOKUP formula:
=VLOOKUP(B4,GradeList,2,TRUE)
3. Press the Enter key, and the grade for English -- B -- is returned.
In the screen shot below, the formula has been copied down to row 6, and the you can see the formula in cell C6.
Makes the formula flexible, so it's easier to copy the formula across a worksheet.
Can prevent problems if new columns are added in the lookup table, or if the lookup columns are rearranged.
This video shows the steps, and there are written instructions for another example, below the video.
Your browser can't show this frame. Here is a <a href="http://youtu.be/JqeIPZBtgPw" rel="nofollow"
target="_blank">link</a> to the page
Here is the worksheet with the VLOOKUP formulas. We want the Region, Order Date and Order Amount for each order,
so 3 VLOOKUP formulas are needed.
If the column numbers are typed in the formula, a different formula is needed in each column:
Region: =VLOOKUP($B6,tblOrdersALL,2,0)
OrderDate: =VLOOKUP($B6,tblOrdersALL,3,0)
OrderAmt: =VLOOKUP($B6,tblOrdersALL,4,0)
1. Select the cell with the formula that you want to copy
2. Point to the fill handle on the selected cell (small square at the bottom right corner)
3. Press the RIGHT mouse button, and drag across to the last cell that needs the formula
4. Release the mouse button, and click on Fill Without Formatting
Combine IF and VLOOKUP
You can use an IF formula with a VLookup formula, to return exact values if found, and an empty string if not found.
To see the steps for setting up the IF and VLOOKUP formula, you can watch this short video. The written instructions are
below the video.
To hide errors by combining IF with VLOOKUP, follow these steps:
1. On the Invoice sheet, in cell A8, enter the product code A28. If the VLookup formula in cell B8 has FALSE as the fourth
argument, the result is #N/A, because there is no exact match for the product code in the lookup table.
2. Wrap the VLookup formula with an IF formula (in this example the product list has been named), using the ISNA function to
check for an #N/A error:
=IF(ISNA(VLOOKUP(A8,ProductList,2,FALSE)),"",VLOOKUP(A8,ProductList,2,FALSE))
3. Press the Enter key, and cell appears blank. Because no exact match was found, the VLookup formula returned an #N/A, so
the ISNA function result is TRUE. The IF formula converted this to an empty string.
If the lookup table contains any blank cells, a VLOOKUP formula will return a zero, instead of a blank cell. You can use
nested IFs to handle the #N/A results, and the empty cell results. For example:
=IF(ISNA(VLOOKUP(A8,ProductList,2,FALSE)),"",
IF(VLOOKUP(A8,ProductList,2,FALSE)="","",
VLOOKUP(A8,ProductList,2,FALSE)))
1. On the Order sheet, in cell B6, enter a 4 as the OrderID. That order was placed in the Central region.
2. To simply check the East region's table, the VLOOKUP formula in cell C6 would be:
=VLOOKUP(B6,OrdersE,2,FALSE)
3. Press the Enter key, and the VLOOKUP formula returns an #N/A, because Order ID 4 is not in the East regions order table.
4. Because an order could have been placed in any of the three regions, you need a formula that will check each table.
If the order ID is not found in the first table, the formula should check second table. If the order ID is not in the second table,
it should check the third table. If the order ID isn't in the third table, then a "Not Found" message should appear in the cell.
5. The IFERROR formula lets you check a value, then specify what to do if an error is found. If you use IFERROR with the
existing formula, you can show "Not Found", instead of the #N/A error:
=IFERROR(VLOOKUP(B6,OrdersE,2,FALSE),"Not Found")
6. To check all three tables, you can next IFERROR and VLOOKUP formulas:
=IFERROR(VLOOKUP(B6,OrdersE,2,FALSE),
IFERROR(VLOOKUP(B6,OrdersW,2,FALSE), IFERROR(VLOOKUP(B6,OrdersC,2,FALSE),
"Not Found")))
This checks the OrdersE table and if an error is found, checks OrdersW table, then OrdersC. If the OrderID is not found in
any of the three tables, the Not Found message is shown in the cell.
You can also check multiple tables in older versions of Excel, where IFERROR is not available, using a longer formula:
=IF(NOT(ISERROR(VLOOKUP(B8,OrdersE,2,FALSE))),
VLOOKUP(B8,OrdersE,2,FALSE),
IF(NOT(ISERROR(VLOOKUP(B8,OrdersW,2,FALSE))),
VLOOKUP(B8,OrdersW,2,FALSE),
IF(NOT(ISERROR(VLOOKUP(B8,OrdersC,2,FALSE))),
VLOOKUP(B8,OrdersC,2,FALSE),"Not Found"))))
If you need to find the price for a large jacket, a VLOOKUP based only on column A would return the price for the first
jacket listed (Medium). You would be underpricing the jacket -- selling it for 60.00, instead of 65.00.
To create unique lookup values, you can insert a new column at the left side of the table, and use a formula to combine the
product and size. In cell A2, the formula combines the value in B2 and the pipe character and the value in C2.
=B2 & "|" &C2
Copy that formula down to the last row of data, so each row has a unique value in column A.
Note: Instead of the pipe character, you could use another character that isn't included in your data.
Then, in a VLOOKUP formula, combine the product and size as the Lookup_value. In cell H1, the formula combines the
value in F1 and the pipe character and the value in G1.
=VLOOKUP(F1 & "|" &G1,$A$2:$D$5,4,FALSE)
Note: The price is now in column 4, instead of column 3.
Troubleshoot the VLOOKUP formula
Your VLOOKUP formula may return an #N/A, even though the value you're looking for appears to be in the lookup table.