Home > Formulas > Lookup > VLOOKUP How to Use Excel VLOOKUP  ExamplesGet started with Excel VLOOKUP function examples. Videos, free workbooks, easy steps. Use VLOOKUP to find product price, or student grades. See how to find and fix VLOOKUP formula problems with troubleshooting. Note: For flexible lookup formulas in Microsoft Excel 365, try the new XLOOKUP function. 
What Does VLOOKUP Function Do?The Microsoft Excel VLOOKUP function does a vertical lookup for a value in the first column in a table, and returns a value from a different column, in the same row, in that table.
In the sections below, VLOOKUP examples show how to find an approximate mateh, or an exact match, and get the data that you need from a lookup table. 
What Goes in VLOOKUP Formula?To look up data with the Excel VLOOKUP function, four pieces of information are used.
Those four items go in the VLOOKUP formula in a specific order, which is called its syntax. Each item in the syntax is called an argument. VLOOKUP Function SyntaxThe VLOOKUP function has the following syntax for its four arguments:
Here are the VLOOKUP arguments  the first 3 are required arguments, and the last one is an optional argument:

Watch this short video, to see how to make a VLOOKUP formula, to find a product price. The written steps are below the video.
Get the Product Price Lookup sample file to follow along with the video (download file #4).
Product Price VLOOKUP ExampleIn the sections below, you'll see how to build a simple order form, where you enter a product name, and the product price is automatically filled in for you. Quick Look at Finished WorkbookBefore you start building the VLOOKUP formulas, here's a quick look at the finished product. In this example, there is an Excel workbook with 2 main sheets  Products, and Order 1) Products sheet has a small lookup table with 2 columns of product information  Product, and Price. 2) On the Order sheet, type a product name, and VLOOKUP formula finds price for that product 
Product Price VLOOKUP StepsHere are the main steps for creating the product price VLOOKUP formula 1) Create Product Lookup table 2) Make an Order Form 3) Add Product Price VLOOKUP The detailed instructions are in the sections below. 1) Create Product Lookup TableThe first step is to enter the product information on the Product worksheet
Format as Excel TableNext, format the product list as a named Excel Table. The table will change size automatically, if you add or remove product details in the future.
Rename the Excel TableNext, change the default name that Excel gave to the new table on the spreadsheet. This step isn't required, but I find it helpful, when creating formulas later.

2) Make an Order FormNext, follow these steps to set up a simple order form on the worksheet named Order.
Formulas will be added to cells B6 and B7 in the next steps. 
4) Add Total Price FormulaThe final step is to add a Total Price formula  the quantity multiplied by the unit price for the product. Select cell B7, and type this formula, then press Enter:
In that formula, the * (asterisk) operator multiplies the quantity (B5) by the unit price (B6), to calculate the total price. Finally, for an additional test, type a different product name and quantity, to see the VLOOKUP formula result. 
Ex 2: Product Price for QuantityIn this example, there are 4 columns for product pricing, based on the minimum quantity ordered. In cell H5, the following formula finds the price, based on product name,. and quantity ordered. VLOOKUP is combined with MATCH, to get the correct price.
This video shows the steps for building the VLOOKUP and MATCH formula. Also, you'll see a problem that can occur if the data is in a named Excel Table. Video Timeline:

Ex 4: Find Column Number with MATCHInstead of typing the column number into a VLOOKUP formula, use the MATCH function to find the correct column in the lookup table. This has a couple of benefits:
This video shows the steps, and there are written instructions for another example, below the video. 
VLOOKUP With MATCH for Order DetailsIn this example, a VLOOKUP formula will return the order details from a lookup table, based on the order ID number. Here is the lookup table, named tblOrders. NOTE: This example is in Sample Workbook #1, on the sheet named OrdersMATCH. 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:
The MATCH FunctionInstead of typing the column number in the VLOOKUP formula, we can use the MATCH function. The MATCH function finds the position of an item in a list, and returns the position number. In the screen shot below, the MATCH formula returns 2 as the position of "Region", in the heading cells (A1:D1) for the lookup table. =MATCH(C5, Orders_ALL!$A$1:$D$1, 0) NOTE: For this technique to work correctly, the headings on the VLOOKUP sheet must match the lookup table headings exactly. To ensure an exact match, the VLOOKUP heading cells are linked to the lookup table heading cells. Add MATCH to VLOOKUPTo add the MATCH function to the VLOOKUP formula, just replace the typed column number =VLOOKUP($B6,tblOrdersALL,2,0) with the MATCH formula, using absolute references to the heading cells on the orders table: =VLOOKUP($B6, tblOrdersALL, MATCH(C5, Orders_ALL!$A$1:$D$1, 0),0) Copy the VLOOKUP Formula AcrossNow, instead of needing a different formula in each column, you can copy the formula across, and use the same formula in all the columns. In each column, it will refer to the heading cell in that column, and find its position in the lookup table. NOTE: If you are filling the formula across columns with different formatting, follow these steps:

Ex 5: Partial VLOOKUP With WildcardsIn addition to looking for specific text values, you can also use wildcards with the VLOOKUP function. The following wildcard characters in Excel represent unknown characters, before, between, or after, other characters
Find Text String in Lookup ColumnIn the example shown below, there are two asterisk wildcards in the formula, before and after the reference to cell B2: =VLOOKUP("*" & B2 & "*",E1:F9,2,FALSE) The formula finds the first month name that contains the letter that's typed in cell B2, and returns that month's ID number Use Multiple WildcardsOne or more wildcards can be used in the lookup value. In the screen shot below, there are two asterisk wildcards in the formula, and a question mark wildcard in cell B2. 
Set up VLOOKUP and IFERROR FormulasTo create the VLOOKUP and IFERROR formulas, follow these steps:
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. 
VLOOKUP Problems & TroubleshootingOccasionally, you might run into problems when using the VLOOKUP function. In the sections below, you'll find tips for avoiding problems, and steps for fixing problems that do occur. 1) VLOOKUP Problems to Watch For 2) Troubleshoot VLOOKUP formula 3) Problems When Sorting VLOOKUP formula 4) Faster VLOOKUP with COUNTIF 5) Video Transcript: Fix VLOOKUP Error 1) VLOOKUP Problems to Watch ForThe VLOOKUP function can cause a few problems, so here are a couple things to watch for, when using this function in your Excel workbooks  slow calculation and sorting problems. Slow CalculationVLOOKUP can be slow, especially when doing a text string match, in an unsorted table, where an exact match is requested. To make VLOOKUP as fast as possible, try these tips:
Note: Other functions, such as INDEX and MATCH, or XLOOKUP, can be used to return values from a table, and can be faster Sorting ProblemsAfter you create a VLOOKUP formula, it might return the correct results at first. However, it might change to incorrect results later, after the list of items is sorted. This sorting problem can cause serious problems, if you don't notice that the results have changed. You could end up charging the wrong prices for all of your products! To see what causes this problem, and how to fix the problem, and avoid the problem in the future. go to the Problems When Sorting VLOOKUP formula section, further down on this page. There are written steps, and a short video that shows the problem and the fix. 
2) Troubleshoot VLOOKUP formulaYour VLOOKUP formula may return an #N/A, even though the value you're looking for appears to be in the lookup table. Common causes for this are: A) Text vs. NumberA common cause for this error is that one of the values is a number, and the other is text. For example, the lookup table may contain '123 (text), and the value to look up is 123 (a number).
1. Lookup values are Text, and the table contains NumbersIf the lookup table contains numbers, and the value to look up is text, use a formula similar to the following: =VLOOKUP(A7, Products!$A$2:$C$5,3, FALSE) The double unary () converts text to a number, and will work correctly even if the lookup values are numbers. 2. Lookup values are Numbers, and the table contains TextIf the lookup table contains text, and the value to look up is numeric, use a formula similar to the following: =VLOOKUP(A7 & ""),Products!$A$2:$C$5,3,FALSE) The TEXT function converts a number to text, and will work correctly even if the lookup values are text. In the first example, the & operator creates a text string from an unformatted number. In the second example, a number formatted with leading zeros (e.g. 00123) would match a text "number" with leading zeros. Video: Text vs NumbersTo see the steps for fixing the VLOOKUP problem when the lookup table has text values, watch this short video tutorial. The full transcript for this video is further down the page. Video Timeline

B) Spaces in one value, and not the otherAnother potential cause for no matching value being found is a difference in spaces. One of the values may contain leading spaces (or trailing, or embedded spaces), and the other doesn't. To test the values, you can use the LEN function, to check the length of each value. For example: =LEN(A7) will return the number of characters in cell A7. It should be equal to the number of characters in the matching cell in the lookup table. If possible, remove the unnecessary spaces, and the VLOOKUP formula should work correctly. If you can't remove the spaces, use the TRIM function in the VLOOKUP, to remove leading, trailing or duplicate spaces. For example: =VLOOKUP(TRIM(A7), ProductList,2,FALSE) C) Other CharactersIf TRIM function alone doesn't solve the problem, you can try one of the following suggestions: SUBSTITUTE FunctionUse the SUBSTITUTE function to remove unwanted characters. There is an example on the Contextures blog: Clean Excel Data With TRIM and SUBSTITUTE CLEAN FunctionAnother way to fix VLOOKUP problems is with the CLEAN function, which can remove some unwanted characters from the text. There is more information on the CLEAN function in this Contextures blog post: 30 Excel Functions in 30 Days: 29  CLEAN 
Unicode CharactersIn some cases, your data might have hidden characters, copied from a website, and the Excel CODE function doesn't recognize those characters. I ran into that problem, and wrote about it on my Contextures blog.
Usually those characters are at the start or end of the text, and my blog article describes how to find those characters, and use them in your VLOOKUP formula. Clean Hidden Characters From DataInstead of using the hidden characters in the VLOOKUP formula, you might prefer to clean the data, and get rid of the hidden characters. If so, the steps below show how to extract the characters from the cell value, using the LEFT and RIGHT functions. Then do a Find and Replace, using those extracted characters NOTE: Before trying this technique, make a backup copy of your workbook. 1) Extract Hidden CharactersIn this example, one of the values with hidden characters was copied to a blank sheet, and pasted in cell B2
Both cells might look empty, after you enter the formulas, if they return hidden characters
2) Find and Replace Hidden CharactersNext, if either cell looks empty, try this find/replace technique:
That might fix the problem, and if not, try the same steps, but copy the other empty cell, to Find and Replace its value 
3) Problems When Sorting VLOOKUP formulaA VLOOKUP formula may return the correct results at first, but then shows incorrect results if the list of items is sorted. This can occur if the reference to the Lookup value includes a sheet name. For example: =VLOOKUP('Order Form'!B5, Products!$B$2:$C$6,2,FALSE) NOTE: This problem can occur with other functions too, such as an INDEX/MATCH lookup formula. Watch this video to see the steps for fixing the problem, and download the VLOOKUP Sorting problem sample file to follow along. The written instructions are below the video. 
Sheet Names in ReferenceThis type of reference is created if you click on another sheet while building the formula. As soon as you do that, Excel adds the sheet name to any subsequent references in the formula. In the screen shot above, Dress is in cell B9, and cell C9 shows the correct price of $30. However, after sorting the products AZ, the Dress moves up to cell B5, but the formula in cell C5 continues to refer to cell B9. Because of the sheet names in the references, Excel retains the original references, instead of keeping a reference to the current row. Cell C5 is showing the price for a Sweater, instead of a Dress. ▲TOP Fix the ProblemTo solve the problem, remove any unnecessary sheet names from the VLOOKUP cell references. Here is the revised formula for cell C5: =VLOOKUP(B5, Products!$B$2:$C$6,2, FALSE) After the unnecessary sheet names are removed, the list can be safely sorted, and the correct results will show for each item. 
4) Faster VLOOKUP with COUNTIFThe VLOOKUP function can be slow when doing an exact match for a text string. In this example, the VLOOKUP formula will find the exact price for a selected product, without using the Exact Match setting. IMPORTANT: To prevent incorrect results, the lookup table must be sorted by the first column, in ascending order (AZ)
Here is the formula in cell C7:
Here's how the IF formula works, with these 3 arguments:
In the screen shot below, the correct price was returned:

5) Video Transcript: Fix VLOOKUP ErrorHere is the full transcript for the Numbers and Text Troubleshooting video shown above.  Usually the VLOOKUP formula in Excel works very well. We could enter product code, and the VLOOKUP formula would return the product name or price for that product code. But in this example, we've typed a code here. We can see that code in the table but the VLOOKUP is returning an N/A error. In the formula bar, you can see that VLOOKUP formula.
So it should be giving us the product but it isn't. So we'll do a bit of troubleshooting, to see what the problem is, and how we can solve it Values Not EqualSometimes the problem is, things that look the same on the worksheet, aren't really a match. We'll see if what we typed in B8 is really a match for what's in B2. In this cell, I'm going to just do a simple test.
It's coming back FALSE, so there's something different about these values
So how can we fix this? Fix Values Not EqualIf we select all these cells, one way to fix it, would be to change all of these to numbers, so they match the values we're going to type in here as numbers. To do that, I can:
That's automatically changed all of these to numbers, and you can see that our VLOOKUP is working correctly now. So it's showing me that 123 is the product called Paper. Change VLOOKUP FormulaIn some cases, you can't change your lookup table, so we can change our lookup formula. Here we have VLOOKUP(B7 So, whatever is in B7, look up in this table. And it can't find this number, because this is text. So we'll change this lookup to text.
So now this used to be a number. When we add an empty string, it's going to automatically become text I'll press Enter, and now what's entered as a number here, it's converted that to text, so it matches what's in here. You can add an empty string in your VLOOKUP formula to convert numbers to text, so the lookups work correctly. 
Get the Sample Files

More Tutorials 
Last updated: January 26, 2023 8:45 PM