How to do a vlookup excel

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

Tip: Try using the new XLOOKUP function, an improved version of VLOOKUP that works in any direction and returns exact matches by default, making it easier and more convenient to use than its predecessor.

Use VLOOKUP when you need to find things in a table or a range by row. For example, look up a price of an automotive part by the part number, or find an employee name based on their employee ID.

In its simplest form, the VLOOKUP function says:

=VLOOKUP(What you want to look up, where you want to look for it, the column number in the range containing the value to return, return an Approximate or Exact match – indicated as 1/TRUE, or 0/FALSE).

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Tip: The secret to VLOOKUP is to organize your data so that the value you look up (Fruit) is to the left of the return value (Amount) you want to find.

Use the VLOOKUP function to look up a value in a table.

Syntax 

VLOOKUP (lookup_value, table_array, col_index_num, [range_lookup])

For example:

  • =VLOOKUP(A2,A10:C20,2,TRUE)

  • =VLOOKUP(«Fontana»,B2:E7,2,FALSE)

  • =VLOOKUP(A2,’Client Details’!A:F,3,FALSE)

Argument name

Description

lookup_value    (required)

The value you want to look up. The value you want to look up must be in the first column of the range of cells you specify in the table_array argument.

For example, if table-array spans cells B2:D7, then your lookup_value must be in column B.


Lookup_value
can be a value or a reference to a cell.

table_array    (required)

The range of cells in which the VLOOKUP will search for the lookup_value and the return value. You can use a named range or a table, and you can use names in the argument instead of cell references. 

The first column in the cell range must contain the lookup_value. The cell range also needs to include the return value you want to find.

Learn how to select ranges in a worksheet.

col_index_num    (required)

The column number (starting with 1 for the left-most column of table_array) that contains the return value.

range_lookup   (optional)

A logical value that specifies whether you want VLOOKUP to find an approximate or an exact match:

  • Approximate match — 1/TRUE assumes the first column in the table is sorted either numerically or alphabetically, and will then search for the closest value. This is the default method if you don’t specify one. For example, =VLOOKUP(90,A1:B100,2,TRUE).

  • Exact match — 0/FALSE searches for the exact value in the first column. For example, =VLOOKUP(«Smith»,A1:B100,2,FALSE).

How to get started

There are four pieces of information that you will need in order to build the VLOOKUP syntax:

  1. The value you want to look up, also called the lookup value.

  2. The range where the lookup value is located. Remember that the lookup value should always be in the first column in the range for VLOOKUP to work correctly. For example, if your lookup value is in cell C2 then your range should start with C.

  3. The column number in the range that contains the return value. For example, if you specify B2:D11 as the range, you should count B as the first column, C as the second, and so on.

  4. Optionally, you can specify TRUE if you want an approximate match or FALSE if you want an exact match of the return value. If you don’t specify anything, the default value will always be TRUE or approximate match.

Now put all of the above together as follows:

=VLOOKUP(lookup value, range containing the lookup value, the column number in the range containing the return value, Approximate match (TRUE) or Exact match (FALSE)).

Examples

Here are a few examples of VLOOKUP:

Example 1

=VLOOKUP (B3,B2:E7,2,FALSE)

VLOOKUP looks for Fontana in the first column (column B) in the table_array B2:E7, and returns Olivier from the second column (column C) of the table_array.  False returns an exact match.

Example 2

=VLOOKUP (102,A2:C7,2,FALSE)

VLOOKUP looks for an exact match (FALSE) of the last name for 102 (lookup_value) in the second column (column B) in the A2:C7 range, and returns Fontana.

Example 3

=IF(VLOOKUP(103,A1:E7,2,FALSE)="Souse","Located","Not found")

IF checks to see if VLOOKUP returns Sousa as the last name of employee correspoinding to 103 (lookup_value) in A1:E7 (table_array). Because the last name corresponding to 103 is Leal, the IF condition is false, and Not Found is displayed.

Example 4

=INT(YEARFRAC(DATE(2014,6,30),VLOOKUP(105,A2:E7,5,FLASE),1))



VLOOKUP looks for the birth date of the employee corresponding to 109 (lookup_value) in the A2:E7 range (table_array), and returns 03/04/1955. Then, YEARFRAC subtracts this birth date from 2014/6/30 and returns a value, which is then converted by INY to the integer 59.

Example 5

IF(ISNA(VLOOKUP(105,A2:E7,2,FLASE))=TRUE,"Employee not found",VLOOKUP(105,A2:E7,2,FALSE))



IF checks to see if VLOOKUP returns a value for last name from column B for 105 (lookup_value). If VLOOKUP finds a last name, then IF will display the last name, otherwise IF returns Employee not found. ISNA makes sure that if VLOOKUP returns #N/A, then the error is replaced by Employee not found, instead of #N/A.



In this example, the return value is Burke, which is the last name corresponding to 105.

You can use VLOOKUP to combine multiple tables into one, as long as one of the tables has fields in common with all the others. This can be especially useful if you need to share a workbook with people who have older versions of Excel that don’t support data features with multiple tables as data sources — by combining the sources into one table and changing the data feature’s data source to the new table, the data feature can be used in older Excel versions (provided the data feature itself is supported by the older version).

A worksheet with columns that use VLOOKUP to get data from other tables

Here, columns A-F and H have values or formulas that only use values on the worksheet, and the rest of the columns use VLOOKUP and the values of column A (Client Code) and column B (Attorney) to get data from other tables.

  1. Copy the table that has the common fields onto a new worksheet, and give it a name.

  2. Click Data > Data Tools > Relationships to open the Manage Relationships dialog box.

    The Manage Relationships dialog box

  3. For each listed relationship, note the following:

    • The field that links the tables (listed in parentheses in the dialog box). This is the lookup_value for your VLOOKUP formula.

    • The Related Lookup Table name. This is the table_array in your VLOOKUP formula.

    • The field (column) in the Related Lookup Table that has the data you want in your new column. This information is not shown in the Manage Relationships dialog — you’ll have to look at the Related Lookup Table to see which field you want to retrieve. You want to note the column number (A=1) — this is the col_index_num in your formula.

  4. To add a field to the new table, enter your VLOOKUP formula in the first empty column using the information you gathered in step 3.

    In our example, column G uses Attorney (the lookup_value) to get the Bill Rate data from the fourth column (col_index_num = 4) from the Attorneys worksheet table, tblAttorneys (the table_array), with the formula =VLOOKUP([@Attorney],tbl_Attorneys,4,FALSE).

    The formula could also use a cell reference and a range reference. In our example, it would be =VLOOKUP(A2,’Attorneys’!A:D,4,FALSE).

  5. Continue adding fields until you have all the fields that you need. If you are trying to prepare a workbook containing data features that use multiple tables, change the data source of the data feature to the new table.

Problem

What went wrong

Wrong value returned

If range_lookup is TRUE or left out, the first column needs to be sorted alphabetically or numerically. If the first column isn’t sorted, the return value might be something you don’t expect. Either sort the first column, or use FALSE for an exact match.

#N/A in cell

  • If range_lookup is TRUE, then if the value in the lookup_value is smaller than the smallest value in the first column of the table_array, you’ll get the #N/A error value.

  • If range_lookup is FALSE, the #N/A error value indicates that the exact number isn’t found.

For more information on resolving #N/A errors in VLOOKUP, see How to correct a #N/A error in the VLOOKUP function.

#REF! in cell

If col_index_num is greater than the number of columns in table-array, you’ll get the #REF! error value.

For more information on resolving #REF! errors in VLOOKUP, see How to correct a #REF! error.

#VALUE! in cell

If the table_array is less than 1, you’ll get the #VALUE! error value.

For more information on resolving #VALUE! errors in VLOOKUP, see How to correct a #VALUE! error in the VLOOKUP function.

#NAME? in cell

The #NAME? error value usually means that the formula is missing quotes. To look up a person’s name, make sure you use quotes around the name in the formula. For example, enter the name as «Fontana» in =VLOOKUP(«Fontana»,B2:E7,2,FALSE).

For more information, see How to correct a #NAME! error.

#SPILL! in cell

This particular #SPILL! error usually means that your formula is relying on implicit intersection for the lookup value, and using an entire column as a reference. For example, =VLOOKUP(A:A,A:C,2,FALSE). You can resolve the issue by anchoring the lookup reference with the @ operator like this: =VLOOKUP(@A:A,A:C,2,FALSE). Alternatively, you can use the traditional VLOOKUP method and refer to a single cell instead of an entire column: =VLOOKUP(A2,A:C,2,FALSE).

Do this

Why

Use absolute references for range_lookup

Using absolute references allows you to fill-down a formula so that it always looks at the same exact lookup range.

Learn how to use absolute cell references.

Don’t store number or date values as text.

When searching number or date values, be sure the data in the first column of table_array isn’t stored as text values. Otherwise, VLOOKUP might return an incorrect or unexpected value.

Sort the first column

Sort the first column of the table_array before using VLOOKUP when range_lookup is TRUE.

Use wildcard characters

If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters—the question mark (?) and asterisk (*)—in lookup_value. A question mark matches any single character. An asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) in front of the character.

For example, =VLOOKUP(«Fontan?»,B2:E7,2,FALSE) will search for all instances of Fontana with a last letter that could vary.

Make sure your data doesn’t contain erroneous characters.

When searching text values in the first column, make sure the data in the first column doesn’t have leading spaces, trailing spaces, inconsistent use of straight ( ‘ or » ) and curly ( ‘ or “) quotation marks, or nonprinting characters. In these cases, VLOOKUP might return an unexpected value.

To get accurate results, try using the CLEAN function or the TRIM function to remove trailing spaces after table values in a cell.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Connect with an expert. Learn from live instructors.

See Also

XLOOKUP function

Video: When and how to use VLOOKUP

Quick Reference Card: VLOOKUP refresher

How to correct a #N/A error in the VLOOKUP function

Look up values with VLOOKUP, INDEX, or MATCH

HLOOKUP function

Need more help?

The Function VLOOKUP in Excel allows rearranging data from one table to the corresponding cells in another one.

It’s very handy and frequently used. As it’s a problematic thing to compare manually ranges with tens of thousands of names.



How to use The Function VLOOKUP in Excel

For example, the warehouse of the enterprise for the production of packaging received materials in a certain amount. The cost of materials is in the price list. This is a separate table.

Separate table.

It is necessary to find out the cost of materials received at the warehouse. To do this we should substitute the price of the second table in the first. And by ordinary multiplication we will find the title.

Algorithm:

  1. Here is the first table (for the warehouse) in the required view. Add columns «Per unit price» and total «Price». Establish a currency format for the new cells.
  2. Select the first cell in the «Price» column. In our example it’s D2. Call the «Insert Function» using the «FX» button (at the beginning of the formula bar) or by pressing the hot key combination SHIFT + F3. In the category «Lookup & Reference» we find the function =VLOOKUP(), and click OK. This function can be called up by clicking on the «FORMULAS» tab and choose from the drop-down list of «Lookup & Reference».
  3. Lookup Reference.

  4. A window with the function arguments will be opened. In the field «Lookup_value» — the first column of the range of data from the table with the number of received materials. These are the values that Excel should find in the second table.
  5. The next argument is «Table_array». This is our price list. Put the cursor in the field of argument than go to the list prices. Select the range with the names of materials and prices. Show what value the function should match.
  6. For Excel to refer directly to these data, it is necessary to fix the link. Select «Table_array» field value and press F4. $ Icon appears.
  7. In the argument «Col_index_num» put the number «2». Here are the data that you need to get in the first table. «Range_lookup» is FALSE. As we need specific, not approximate.

Range_lookup.

Click OK. And then copy the function of that column: we catch a mouse bottom right corner and drag down. We get the necessary result.

get the necessary result.

Now to find the cost of materials is not difficult: the number of * cost.

Function VLOOKUP linked the two tables. If you change the price, and then change the value of the materials received at the warehouse (now received). To avoid this, use the «Paste Special».

  1. Select the column with inserted prices.
  2. Use the right mouse button – «Copy».
  3. Still selected use the right mouse button – «Paste Special».
  4. Put a tick next to «Values». OK.

Values.

The formulas in the cells disappear. Only values remain.



A quick comparison of the two tables with the help of VLOOKUP

The function helps to compare the values in large tables. In case of the price has changed. We need to compare the old prices with the new prices.

large tables.

  1. In the old price list do the column «NEW Price».
  2. NEW Price.

  3. Select the first cell and select the function VLOOKUP. The given examples (see. Above). For example:

VLOOKUP.

This means that you need to take the name of the material from the range A2: A15, look it up in the «new prices» in column A. Then take the data from the second column of the new price (Per unit price) and substitute them in cell C2 under «NEW Price».

The data presented in this way, can be compared. We can find the numeral and percentage difference.

The function VLOOKUP in Excel with multiple conditions

Until now, we have offered for the analysis of only one condition — the name of the material. In practice, it often requires several bands to compare and select the data value 2, 3 and other criteria.

Table for example:

Table for example.

Guessing we need to find, what is the price of the corrugated cardboard of JSC «Magnet». It is necessary to set two conditions to search the name of the material and the vendor.

The matter is complicated by the fact that one supplier receives several names.

  1. Adding to the table the leftmost column (important!), combining the «Provider» and «Materials».
  2. combining.

  3. We combine the required criteria the same way:
  4. Put the cursor in the right place H3 and set arguments for function:

arguments for function.

Excel finds the right price.

Consider the formula in detail:

  1. What we are looking for – request the addition of a criterion F3&G3.
  2. Where to look for – range of data A2:D15.
  3. What data to take – column number 4 in the range A2:D15.

The Function VLOOKUP and drop-down list

For example, some data is made in the form of a drop-down list. In our example it is «Materials». It is necessary to configure the function so that when choosing names appeared prices.

First do drop-down list:

  1. Go to sheet «price list» and create a table for requests in the range E1:G2.
  2. Data Validation.

  3. Put the cursor in cell F3, where will be this list and go to the tab «DATA». «Data Validation» menu.
  4. Data Validation.

  5. Select the type of data – «List». Source is the range with the names of materials.
  6. List.

  7. When press the OK the dropdown list is formed.

list is formed.

Now you need to make the way when choosing a particular material in the column price corresponding figure appeared. Put the cursor in the F2 cell (which will have to appear the price).

  1. Open the window «Insert Function» and select VLOOKUP.
  2. The first argument is «Lookup_value» – the box with drop-down list. The table is a range of materials with names and prices. And column 2. Function has acquired the following form:
  3. In a cell G2, enter the formula (formula different column number 3):
  4. Press ENTER and enjoy the result.

enjoy the result.

Change the material — the price changes:

price changes.

Download this example VLOOKUP in Excel

This is how the drop down list in Excel with the function of the VLOOKUP. Everything happens automatically within a few seconds. Everything works quickly and accurately. It is necessary to deal with this function.

When you learn the price of the menu below, first your eyes will look up vertically to find your favorite pie, such as The Mushroom Lover. Then your vision slides to the right to find the price for the L size – $27.99.

  • 1. VLOOKUP concept

You’ve just done a vertical lookup, or vlookup. For this purpose, spreadsheet apps including Excel usually provide a specified function called VLOOKUP. In this article, we’ll explore how you can use the Excel VLOOKUP function, check out a few examples, and learn how to troubleshoot it. 

What is VLOOKUP in Excel

VLOOKUP stands for vertical lookup. It is a function in Excel that searches vertically a specified value in a column to return a matching value, or values in the same row from different columns. 

VLOOKUP syntax in Excel

=VLOOKUP("lookup_value",lookup_range, column_number, [match])
  • "lookup_value" is the value you want to look up vertically. Quotes are not used if you reference a cell as a lookup value.
  • lookup_range is the data range where you’ll search for the lookup_value and the matching value. 
  • column_number is the number of the column in the lookup_range, which contains the matching value to return. For example, if your range is D7:G18, D is the first column, E is the second one, and so on.
  • [match] is the optional parameter to choose either closest or exact match. To return the closest match, specify TRUE; to return an exact match, specify FALSE. The closest match (TRUE) is set by default.

How to VLOOKUP in Excel – formula example

We have the following dataset with the details of courses:

  • 2-dataset-to-vlookup

Let’s search for the day when College Writing III is scheduled. Here is the VLOOKUP formula to do this:

=VLOOKUP(A10,A2:H12,6,FALSE)
  • A10 – the lookup_value “College Writing III
  • A2:H12 – the lookup_range
  • 6 – the column number to return the matching value from
  • FALSE – the exact match to return
  • 3-vlookup-formula-example

The result of the schedule for College Writing III is Thursday. And here is how the logic of this VLOOKUP formula looks:

  • 3. VLOOKUP concept explanation
  • Excel searches the value of A10 (College Writing III) in the lookup column (A2:A12).
  • If the value is found, Excel moves across the row to column number 6 of the specified data lookup range (A2:H12). Column A is the first column in the lookup range, because column A contains the lookup value.
  • As the formula is set to FALSE (to find the exact match) then the return value is Thursday (you can see the result in A14).

What you should know about VLOOKUP in Excel

  • The VLOOKUP function executes a case-insensitive lookup.
  • Excel VLOOKUP returns a #N/A if the lookup_value is not able to be found inside the lookup_range.
  • Excel VLOOKUP returns a #VALUE! error if the value of column_number is less than 1.
  • Excel VLOOKUP returns a #REF! error if the value of column number is greater than the number of columns in the lookup_range.
  • The closest match (TRUE) is specified by default.

How to pull your data to Excel for vertical lookup 

The example above is basic for you to understand the logic of the Excel VLOOKUP function. Your cases probably will be more advanced for the data that you can import from different sources to Excel. How? Coupler.io, an integration solution, is designed to export data from multiple apps and sources to Excel or Google Sheets or BigQuery on a schedule. You just need to sign up to Coupler.io and:

  • Select and set up a source:
  • 4. Importing data using Coupler.io step 1

Check out the HubSpot to Excel integration.

  • Select and set up a destination (in our case – Microsoft Excel)
  • 5. Importing data using Coupler.io step 2
  • Set up a schedule (optionally) if you want to automate export of your data on a custom schedule.
  • Set up schedule

With your data exported from BigQuery, HubSpot, Xero, etc. to Microsoft Excel, you can easily vlookup it.

How to use VLOOKUP in Excel

There are two ways to access VLOOKUP in Excel – you can use the VLOOKUP formula in the formula bar or access it through the menu bar.

Type directly into the cell

In the example above, we used VLOOKUP in Excel this way. You need to click in the cell where you want the answer to appear, then put the cursor on Formula Bar. Type the VLOOKUP formula and all its parameters directly into the formula bar:

  • 7. Type directly into the cell

  • In the menu bar, select the Formulas tab, then select Lookup & Reference.  
  • 8. Using menu bar part 1
  • An alphabetical menu will drop down – choose VLOOKUP
  • 9. Using menu bar part 2
  • On your right side, the Formula Builder will appear.
  • On your right side, The Formula Builder will appear.
  • Fill each box in the Formula Builder as your VLOOKUP formula parameters, then click Done.

Here is how it will look for our Vlookup formula example:

  • Here is how it will look for our Vlookup formula example:

The result is the same – Thursday. So it is up to you which way is easier for you to use the VLOOKUP function 🙂

Excel VLOOKUP for an array

In the Excel VLOOKUP, you can use an array as a lookup_value. This will let you search the matches for multiple values. 

Let’s take the data set from above and vertically look up for the days when the values from the range A14:A20 are scheduled. 

  • 12. VLOOKUP array step 1

Here is the VLOOKUP formula to do this:

=VLOOKUP(A14:A20,Sheet1!A2:H12,6,FALSE) 
  • A14:A20 – the lookup array
  • Sheet1!A2:H12 – the lookup range
  • 6 – the column number to return the matching value from
  • FALSE – the exact match to return
  • 13. VLOOKUP array formula

Excel vlookup cases

Check out the following specific cases of how to vlookup data in Excel:

  • How to VLOOKUP for multiple matches
  • How to VLOOKUP for two values
  • How to VLOOKUP for multiple criteria
  • How to compare two columns in Excel using VLOOKUP
  • How to VLOOKUP another sheet in Excel 
  • How to vlookup another workbook/spreadsheet in Excel
  • How to vlookup multiple columns in Excel
  • Excel SUMIF with VLOOKUP

Excel reverse VLOOKUP

VLOOKUP in Excel can only look up the matching values from left to right. 

  • 3-vlookup-formula-example

And what if your data set look like this and you need to look up values from right to left:

  • VLOOKUP in Excel to the left

Unfortunately, in this case you can’t use VLOOKUP, but the Excel XLOOKUP function will do the job. 

Note: The XLOOKUP function is only available in Excel Online and Microsoft 365.

Reverse VLOOKUP syntax

=XLOOKUP("lookup_value", lookup_array, return_array, "[if_not_found]", [match_mode], [search_mode])
  • lookup_value is the value you want to look up vertically.
  • lookup_array is the data array to search the lookup_value
  • return_array is the data array to return the matching value.
  • [if_not_found] is the optional parameter to return a specified text if the lookup_value has not been found.
  • [match_mode] is the optional parameter to choose the match mode:
    • 0 – Exact match (default)
    • -1 – If the exact match is not found, the next smallest item is returned.
    • 1 – If the exact match is not found, the next largest item is returned.
    • 2 – A wildcard match where *, ?, and ~ have special meaning.
  • [search_mode] is the optional parameter to choose the search mode:
    • 1 – Search starting at the first item (default).
    • -1 – Search starting at the last item.
    • 2 – Binary search that relies on lookup_array being sorted in ascending order. If not sorted, invalid results will be returned.
    • -2 – Binary search that relies on lookup_array being sorted in descending order. If not sorted, invalid results will be returned.

Reverse VLOOKUP formula example

Let’s search for the day when Lab Only is scheduled. Here is the XLOOKUP formula to do this:

=XLOOKUP("Lab Only",H2:H12,E2:E12,"Not found")
  • "Lab Only" – the lookup value.
  • H2:H12 – the data array to search for the lookup value
  • E2:E12 – the data array to return the matching value.
  • "Not found" – the text to return if the lookup value has not been found.
  • 15.xlookup formula example

Another way to do a reverse vlookup is using a combination of the INDEX and MATCH functions, please see this section to learn about these functions.

If your VLOOKUP formula is not working in your Excel

Sometimes when you use VLOOKUP, the #N/A error message appears. It is the most dreaded and trickiest to handle. Here, we give the five most common reasons why your VLOOKUP is not working, including the solution for each case.

#1: Exact match in the VLOOKUP formula is not specified

Issue

On the following screenshot, we have a VLOOKUP formula, which returns an incorrect result. The correct vlookup result for ID 18 is Apple not Peach.

  • 16. VLOOKUP troubleshooting 1

Solution

Enter FALSE as the last parameter if you are looking for an exact match. The correct VLOOKUP formula is

=VLOOKUP(E3,A2:C8,2,FALSE)
  • 16. VLOOKUP troubleshooting 2

Explanation

The last parameter in the VLOOKUP function is Closest match (TRUE) or Exact match (FALSE). Most people are searching for a certain match such as for customer name, product name or employee name that need an exact match. FALSE should be entered for the last parameter in your VLOOKUP formula when you are looking for an exact value.

#2: The range in the VLOOKUP formula is not locked

Issue

When you drag your working Excel VLOOKUP formula down

=VLOOKUP(E3,A2:C8,2,FALSE)

it returns the #N/A error.

  • 16. VLOOKUP troubleshooting 3

Solution

You need to lock the range in your VLOOKUP formula before dragging it or copying to other cells. To do this, type $ around the range as shown below: 

  • 16. VLOOKUP troubleshooting 4

Your VLOOKUP formula should look like this:

=VLOOKUP(E3,$A$2:$C$8,2,FALSE)

Now you can drag it without any errors expected. 

Explanation

Once you dragged your VLOOKUP formula, the range in it changed, which caused the error.

#3: A new column has been inserted to the range

Issue

A new column was inserted and affected the range that was specified in your VLOOKUP formula. 

=VLOOKUP(E3,A2:C8,2,FALSE)
  • 16. VLOOKUP troubleshooting 5

Solution

To avoid this in the future, you need to make the column number dynamic using the MATCH function. This allows you to retrieve the matched position of a lookup value and column number. In this way, any new inserted columns won’t affect your VLOOKUP formula.

We updated our formula, so it looks like this.

=VLOOKUP(F3,A2:D8,MATCH(G2,A1:D1,0),FALSE)
  • G2 – the value to match in lookup range.
  • A1:D1 – the lookup range.
  • 0 – exact match type.
  • 16. VLOOKUP troubleshooting 6

Let’s test the new lookup range by adding more columns as shown in the figure below:

  • 16. VLOOKUP troubleshooting 7

The result does not change.

#4: Your table has gotten bigger

Issue

Your VLOOKUP formula was made for a specific limited range. You’ll have to update the formula manually every time when the range grows with new rows. Or not? 

  • 16. VLOOKUP troubleshooting 8

Solution

Not only can you set the column dynamic, but also the range, by giving it a name. This will help you ensure your VLOOKUP function always checks the whole table by following these steps:

  1. Select the range of cells you want to use for the lookup range. Click HomeFormat as Table and choose Orange, Table Style Medium 3 (or any other style you desire). 
  • 16. VLOOKUP troubleshooting 9
  1. Specify your lookup range: $A$1:$C$12. Check the box My table has headers then click OK as shown in the screenshot below:
  • 16. VLOOKUP troubleshooting 10
  1. Update your lookup range in the VLOOKUP formula as follows:
  • 16. VLOOKUP troubleshooting 11

Let’s test the new lookup range by adding one more row. Check your VLOOKUP by searching the new ID that you just added to the lookup range. The result returns the correct value as shown in figure below:

  • 16. VLOOKUP troubleshooting 12

#5: Reverse VLOOKUP for those who do not have XLOOKUP in their version of Excel

Issue

The VLOOKUP formula cannot look up a value to the left, and your Excel does not have XLOOKUP.

Solution

You can vlookup to the left using the combination of the INDEX and MATCH functions:

  1. Suppose you want to look up the ID for Coconut from the table below:
  • 16. VLOOKUP troubleshooting 13
  1. Type the following formula below in cell F3:
=INDEX(A2:A8,MATCH(E3,B2:B8,0))
  • INDEX – a function in Excel that returns the value from a certain location in a range.
  • A2:A8 – the range column where ID is stored is from A2-A8.
  • MATCH – a function in Excel that used to locate the position of a lookup value in a table/column/row.
  • E3 – where ‘Coconut’ is located.
  • B2:B8 – the range column where Coconut is stored from B2:B8.
  • 0 – an exact match of the return value.
  1. The result is:
  • 16. VLOOKUP troubleshooting 14

Is there any difference between VLOOKUP in Excel and Google Sheets

Basically, VLOOKUP in Excel and Google Sheets has the same logic and the same syntax. So, if you migrate to Excel from Google Sheets, you won’t have any troubles. But of course, there are some differences. Check out our blog post about VLOOKUP in Google Sheets to find them. Good luck with looking up your data!

  • Piotr Malek

    Technical Content Writer on Coupler.io who loves working with data, writing about it, and even producing videos about it. I’ve worked at startups and product companies, writing content for technical audiences of all sorts. You’ll often see me cycling🚴🏼‍♂️, backpacking around the world🌎, and playing heavy board games.

Back to Blog

Focus on your business

goals while we take care of your data!

Try Coupler.io

VLOOKUP is an Excel function to get data from a table organized vertically. Lookup values must appear in the first column of the table passed into VLOOKUP.  VLOOKUP supports approximate and exact matching, and wildcards (* ?) for partial matches. 

Vertical data | Column Numbers | Only looks right | Matching Modes | Exact Match | Approximate Match | First Match | Wildcard Match | Two-way Lookup | Multiple Criteria | #N/A Errors | Videos

Introduction

VLOOKUP is probably the most famous function in Excel, for reasons both good and bad. On the good side, VLOOKUP is easy to use and does something very useful. For new users in particular, it is immensely satisfying to watch VLOOKUP scan a table, find a match, and return a correct result. Using VLOOKUP successfully is a rite of passage for many Excel users.

On the bad side, VLOOKUP is limited and has dangerous defaults. Unlike INDEX and MATCH (or XLOOKUP), VLOOKUP needs a complete table with lookup values in the first column. This makes it hard to use VLOOKUP with multiple criteria. In addition, VLOOKUP’s default matching behavior makes it easy to get incorrect results. Fear not. The key to using VLOOKUP successfully is mastering the basics. Read on for a complete overview.

Arguments

VLOOKUP takes four arguments: lookup_value, table_array, column_index_num, and range_lookup. Lookup_value is the value to look for, and table_array is the range of vertical data to look inside. The first column of table_array must contain the lookup values to search. The column_index_num argument is the column number of the value to retrieve, where the first column of table_array is column 1. Finally, range_lookup controls match behavior. If range_lookup is TRUE, VLOOKUP will perform an approximate match. If range_lookup is FALSE, VLOOKUP will perform an exact match. Important: range_lookup is optional and defaults to TRUE, so VLOOKUP will perform an approximate match by default. See below for more information on matching.

V is for vertical

The purpose of VLOOKUP is to look up information in a table like this:

VLOOKUP is for vertical data

With the Order number in column B as the lookup_value, VLOOKUP can get the Cust. ID, Amount, Name, and State for any order. For example, to get the name for order 1004, the formula is:

=VLOOKUP(1004,B5:F9,4,FALSE) // returns "Sue Martin"

To look up horizontal data, you can use HLOOKUP, INDEX and MATCH, or XLOOKUP.

VLOOKUP is based on column numbers

When you use VLOOKUP, imagine that every column in the table_array is numbered, starting from the left. To get a value from a given column, provide the number for column_index_num. For example, the column index to retrieve the first name below is 2:

VLOOKUP is based on column numbers

By changing only column_index_num, you can look up columns 2, 3, and 4:

=VLOOKUP(H3,B4:E13,2,FALSE) // first name
=VLOOKUP(H3,B4:E13,3,FALSE) // last name
=VLOOKUP(H3,B4:E13,4,FALSE) // email address

Note: normally, we would use an absolute reference for H3 ($H$3) and B4:E13 ($B$4:$E$13) to prevent these from changing when the formula is copied. Above, the references are relative to make them easier to read.

VLOOKUP only looks right

VLOOKUP can only look to the right. In other words, you can only retrieve data to the right of the column that holds lookup values:

VLOOKUP can only look to the right

To lookup values to the left, see INDEX and MATCH, or XLOOKUP.

Match modes

VLOOKUP has two modes of matching, exact and approximate, controlled by the fourth argument, range_lookup. The word «range» in this case refers to «range of values» – when range_lookup is TRUE, VLOOKUP will match a range of values rather than an exact value. A good example of this is using VLOOKUP to calculate grades. When range_lookup is FALSE, VLOOKUP performs an exact match, as in the example above.

Important: range_lookup is optional defaults to TRUE. This means approximate match is the default behavior, which can be dangerous. Set range_lookup to FALSE to force exact matching:

=VLOOKUP(value,table,col_index) // approximate match (default)
=VLOOKUP(value,table,col_index,TRUE) // approximate match
=VLOOKUP(value,table,col_index,FALSE) // exact match

Tip: always supply a value for range_lookup as a reminder of expected behavior.

Note: You can also supply zero (0) for an exact match, and 1 for approximate match.

Exact match example

In most cases, you’ll probably want to use VLOOKUP in exact match mode. This makes sense when you have a unique key to use as a lookup value, for example, the movie title in this data:

VLOOKUP exact match with movies

The formula in H6 to find Year, based on an exact match of movie title, is:

=VLOOKUP(H4,B5:E9,2,FALSE) // FALSE = exact match

Approximate match example

When you want the best match, not necessarily an exact match, you’ll want to use approximate mode. For example, below we want to look up a commission rate in the table G5:H10. The lookup values come from column C. In this example, we need to use VLOOKUP in approximate match mode, because in most cases an exact match will never be found. The VLOOKUP formula in D5 is configured to perform an approximate match by setting the last argument to TRUE:

VLOOKUP approximate match commission rate

=VLOOKUP(C5,$G$5:$H$10,2,TRUE) // TRUE = approximate match

VLOOKUP will scan values in column G for the lookup value. If an exact match is found, VLOOKUP will use it. If not, VLOOKUP will «step back» and match the previous row. This means table_array must be sorted in ascending order by lookup value to use approximate match.

Caution: If range_lookup is omitted or TRUE and table_array is not sorted by the first column in ascending order, VLOOKUP may return incorrect or unexpected results.

First match only

In the case of duplicate matching values, VLOOKUP will find the first match. In the screen below, VLOOKUP is configured to find the price for the color «Green». There are three rows with the color Green, and VLOOKUP returns the price in the first row, $17. The formula in cell F5 is:

=VLOOKUP(E5,B5:C11,2,FALSE) // returns 17

VLOOKUP returns first match

Tip: To retrieve multiple matches with a lookup operation, see the FILTER function.

Wildcard match

The VLOOKUP function supports wildcards, which makes it possible to perform a partial match on a lookup value. For instance, you can use VLOOKUP to retrieve information from a table with a partial lookup_value and wildcard. To use wildcards with VLOOKUP, you must use exact match mode by providing FALSE for range_lookup. In the screen below, the formula in H7 retrieves the first name, «Michael», after typing «Aya» into cell H4. Notice the asterisk (*) wildcard is concatenated to the lookup value inside the VLOOKUP formula:

=VLOOKUP($H$4&"*",$B$5:$E$104,2,FALSE)

VLOOKUP wildcard match

Read a more detailed explanation here.

Two-way lookup

Inside the VLOOKUP function, column_index_num is normally hard-coded as a static number. However, you can create a dynamic column index by using the MATCH function to locate the needed column. This technique allows you to create a dynamic two-way lookup, matching on both rows and columns. In the screen below, VLOOKUP is configured to perform a lookup based on Name and Month like this:

=VLOOKUP(H4,B5:E13,MATCH(H5,B4:E4,0),0)

VLOOKUP two-way lookup

For more details, see this example.

Note: In general, INDEX and MATCH is a more flexible way to perform two-way lookups.

Multiple criteria

The VLOOKUP function does not handle multiple criteria natively. However, you can use a helper column to join multiple fields together, and use these fields like multiple criteria inside VLOOKUP.  In the example below, Column B is a helper column that concatenates first and last names together with this formula:

=C5&D5 // helper column

VLOOKUP is configured to do the same thing to create a lookup value. The formula in H6 is:

=VLOOKUP(H4&H5,B5:E13,4,0)

VLOOKUP with multiple criteria

For details, see this example. For a more advanced, flexible approach, see this example.

Note: INDEX and MATCH and XLOOKUP are better for lookups based on multiple criteria.

VLOOKUP and #N/A errors

If you use VLOOKUP you will inevitably run into the #N/A error. The #N/A error means «not found». For example, in the screen below, the lookup value «Toy Story 2» does not exist in the lookup table, and all three VLOOKUP formulas return #N/A:

VLOOKUP #N/A error example

The #N/A error is useful because tells you something is wrong. The reason for #N/A might be:

  • The lookup value does not exist in the table
  • The lookup value is misspelled, or contains extra space
  • Match mode is exact, but should be approximate
  • The table range is not entered correctly
  • You are copying VLOOKUP, and the table reference is not locked

To «trap» the NA error and return a different value, you can use the IFNA function like this:

VLOOKUP #N/A error example - fixed

The formula in H6 is:

=IFNA(VLOOKUP(H4,B5:E9,2,FALSE),"Not found")

The message can be customized as desired. To return nothing (i.e. to display a blank result) when VLOOKUP returns #N/A you can use an empty string («») like this:

=IFNA(VLOOKUP(H4,B5:E9,2,FALSE),"") // no message

You can also use the IFERROR function to trap VLOOKUP #N/A errors. However, be careful with IFERROR, because it will catch any error, not just the #N/A error. Read more: VLOOKUP without #N/A errors 

More about VLOOKUP

  • VLOOKUP with multiple criteria (basic)
  • VLOOKUP with multiple criteria (advanced)
  • How to use VLOOKUP to merge tables
  • 23 tips for using VLOOKUP
  • More VLOOKUP examples and videos

Other notes

  • VLOOKUP performs an approximate match by default.
  • VLOOKUP is not case-sensitive.
  • Range_lookup controls the match mode. FALSE = exact, TRUE = approximate (default).
  • If range_lookup is omitted or TRUE or 1: 
    • VLOOKUP will match the nearest value less than the lookup_value.
    • VLOOKUP will still use an exact match if one exists.
    • The column 1 of table_array must be sorted in ascending order.
  • If range_lookup is FALSE or zero:
    • VLOOKUP performs an exact match.
    • Column 1 of table_array does not need to be sorted.

Понравилась статья? Поделить с друзьями:
  • How to do a sum column in excel
  • How to do a query in excel
  • How to do a presentation in word
  • How to do a mail merge in word
  • How to do a line graph in excel