Excel VLOOKUP Tutorial
In this Excel VLOOKUP tutorial, we discuss what is the VLOOKUP Function in Excel, how it works along with practical examples. The VLOOKUP (vertical lookup) function in Excel looks up a piece of information or value from one column of a table or dataset and extracts and returns some corresponding value or information from another column.
VLOOKUP function in Excel is a built-in function and is named so because the formula looks for value and searches it vertically down a specific column. It stops as soon as it finds that value and looks to the right of that value in a column that we specify.
General Syntax for the VLOOKUP function is as follows:
The VLOOKUP formula syntax has the following arguments:
- Lookup_value: Required, represents the value that we want to look up for in the first column of a table or dataset.
- Table_array: Required, represents the dataset or data array that is to be searched.
- Col_indexnum: Required, represents the integer specifying the column number of the table_array that we want to return a value from
- Range_lookup: Optional, represents or defines what the function should return in case it does not find an exact match to the lookup_value. This argument can be set to ‘FALSE; or ‘TRUE,’ where ‘TRUE’ indicating an approximate match (i.e., use the closest match below the lookup_value in case the exact match is not found), and ‘FALSE’ indicating an exact match (i.e., it returns an error in case the exact match is not found). ‘TRUE’ can also be substituted for ‘1’ and ‘FALSE’ for ‘0’.
Examples
Example #1
Let us suppose we have a student records table consisting of their roll number, name, class, and email ID. Now, if we wish to get the email ID of a particular student from this database, we use the VLOOKUP function as follows:
=VLOOKUP(F2,A2:D12,4,1)
We can see that the formula above looks up the value 6 in the leftmost column of the student records’ table. The third argument with value 4 tells the function to return the value in the same row from the fourth column of the student records’ table. The last argument mentioned as 1 (TRUE) tells the function to return an approximate match (exact match if it exists).
So we can see that the email ID of roll no 6 is correctly extracted and returned with this function.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
Example #2
Now, let’s say we use an exact match for a lookup value that does not exist, then VLOOKUP function will work as follows:
=VLOOKUP(F2,A2:D12,4, 0)
We can see that the formula above looks up the value 16 in the leftmost column of the student records’ table. The third argument with value 4 tells the function to return the value in the same row from the fourth column of the student records’ table. The last argument mentioned as 0 (FALSE) tells the function to return an exact match, and an error if an exact match is not found.
So we can see that the email ID of roll no 16 does not exist as there is no value as roll no 16 in the student records’ table, so the ‘#N/A’ error is returned with an exact match argument.
Example #3
Now, let’s say we use an approximate match for a lookup value that does not exist, then VLOOKUP function will work as follows:
=VLOOKUP(F2,A2:D12,4, 1)
We can see that the formula above looks up the value 16 in the leftmost column of the student records’ table. The third argument with value 4 tells the function to return the value in the same row from the fourth column of the student records’ table. The last argument mentioned as 1 (TRUE) tells the function to return an approximate match if the exact match is not found.
So we can see that there is no value as roll no 16 in the first column of the student records’ table, but the fourth argument mentioned as 1 or TRUE tells of returning an approximate match, so the function will return the largest value smaller than 16 (12 in this case), so email ID of roll no 12 is returned.
Things to Remember
- VLOOKUP function is a built-in function in Excel categorized as a Lookup/Reference Function.
- It can also be used as a worksheet function where the function can be entered as part of a formula in a cell of a worksheet.
- VLOOKUP always looks right, i.e., it requires a lookup table with lookup values in the left-most column. The data we wish to retrieve as result value can appear in any column to the right, i.e., the lookup value is to the left of the result value we wish to find.
- The argument ‘table_array’ provided to the VLOOKUP function must be at least as many columns wide as the value of argument ‘col_indexnum.’
- It is designed to retrieve data in a table that is organized into vertical rows, where each row represents a new record. So, if the data is organized horizontally, then we can use the ‘HLOOKUP’ (horizontal lookup) function.
- VLOOKUP function returns any data type like numeric, date, string, etc.
- VLOOKUP function allows the use of wildcards like ‘*.’
- If ‘FALSE’ or ‘0’ is specified for the approximate_match parameter, and no exact match is found for the lookup value, then the VLOOKUP function returns ‘#N/A’ error.
- If ‘TRUE’ or ‘1’ is specified for the approximate_match parameter, and no exact match is found, then the VLOOKUP function returns the next smaller value.
- If ‘col_indexnum’ is less than 1 or is not recognized as a numeric value, then the VLOOKUP function returns ‘#VALUE!’ error.
- If the ‘range_lookup’ value is not recognized as a logical value, then it returns ‘#VALUE!’ error.
- If ‘col_indexnum’ is greater than a number of columns in ‘table_array,’ then the VLOOKUP function returns ‘#REF!’ error.
- In case the argument ‘range_lookup’ is omitted, then the VLOOKUP function allows a non-exact match, but it will use an exact match if it exists.
- VLOOKUP function is not case-sensitive.
- If the lookup column contains duplicate values, then the VLOOKUP function will match only the first value.
Recommended Articles
This has been a guide to VLOOKUP Tutorial in Excel. In this tutorial, we discuss the VLOOKUP function with its formula and how to use it with some practical examples and a downloadable excel template. You may learn more about excel from the following articles –
- VLOOKUP with Text
- Use Not Blank in SUMIF Function
- VLOOKUP Formula in Excel
- VLookup with Match
- Confidence Interval In Excel
- 35+ Courses
- 120+ Hours
- Full Lifetime Access
- Certificate of Completion