Excel for bloginar.net 365 Excel for bloginar.net 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel năm 2016 Excel năm 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More...Less

Tip: Try using the new XLOOKUPhường function, an improved version of VLOOKUP.. that works in any direction và returns exact matches by default, making it easier và more convenient khổng lồ use than its predecessor.

Bạn đang xem: Hàm c++

Use VLOOKUPhường 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 size, the VLOOKUP. function says:

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


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

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


VLOOKUPhường (lookup_value, table_array, col_index_num, )

For example:



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

Argument name


lookup_value (required)

The value you want khổng lồ look up. The value you want to lớn 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 VLOOKUPhường will tìm kiếm for the lookup_value và the return value. You can use a named range or a table, & 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 khổng lồ include the return value you want lớn find.

Learn how to lớn 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 lớn find an approximate or an exact match:

Approximate match - 1/TRUE assumes the first column in the table is sorted either numerically or alphabetically, và will then tìm kiếm for the closest value. This is the mặc định 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 lớn get started

There are four pieces of information that you will need in order to lớn build the VLOOKUPhường. syntax:

The value you want lớn look up, also called the lookup value.

The range where the lookup value is located. Remember that the lookup value should always be in the first column in the range for VLOOKUPhường lớn work correctly. For example, if your lookup value is in cell C2 then your range should start with C.

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, & so on.

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 sầu 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)).


Here are a few examples of VLOOKUP:

Example 1


Example 2


Example 3


Example 4


Example 5


Combine data from several tables onkhổng lồ one worksheet by using VLOOKUP

You can use VLOOKUPhường lớn combine multiple tables into lớn one, as long as one of the tables has fields in common with all the others. This can be especially useful if you need lớn cốt truyện a workbook with people who have sầu older versions of Excel that don"t bloginar.net data features with multiple tables as data sources - by combining the sources into one table & 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 bloginar.neted by the older version).


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

Copy the table that has the common fields onkhổng lồ a new worksheet, and give sầu it a name.

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


For each listed relationship, note the following:

The field that liên kết 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 VLOOKUPhường 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 lớn look at the Related Lookup Table lớn see which field you want khổng lồ retrieve sầu. You want lớn note the column number (A=1) - this is the col_index_num in your formula.

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

Xem thêm: Cara Aktivasi Adobe After Effects Cs6 Crack Serial Number Full Download

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(<

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).

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


What went wrong

Wrong value returned

If range_lookup is TRUE or left out, the first column needs lớn 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 VLOOKUPhường, see How khổng lồ 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 VLOOKUPhường, see How khổng lồ 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 lớn 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, và 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 lượt thích this: =VLOOKUP(
,A:C,2,FALSE). Alternatively, you can use the traditional VLOOKUPhường method và refer to a single cell instead of an entire column: =VLOOKUP(A2,A:C,2,FALSE).

Do this


Use absolute references for range_lookup

Using absolute references allows you khổng lồ fill-down a formula so that it always looks at the same exact lookup range.

Learn how lớn 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, VLOOKUPhường 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 wildthẻ characters

If range_lookup is FALSE & lookup_value is text, you can use the wildthẻ characters—the question mark (?) & asterisk (*)—in lookup_value. A question mark matches any single character. An asterisk matches any sequence of characters. If you want lớn 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 sầu leading spaces, trailing spaces, inconsistent use of straight ( " or " ) & 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 lớn 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 tư vấn in the Answers community.

See Also

Quick Reference Card: VLOOKUPhường refresher Quichồng Reference Card: VLOOKUPhường troubleshooting tips How to correct a #VALUE! error in the VLOOKUPhường function How khổng lồ correct a #N/A error in the VLOOKUP function Overview of formulas in Excel How to avoid broken formulas Detect errors in formulas Excel functions (alphabetical) Excel functions (by category) VLOOKUP.. (không tính tiền preview)