Table of Contents
The VLOOKUP function in Excel is a tool for looking up a piece of information in a table or data set and extracting some corresponding data/ information. Vlookup (V stands for ‘Vertical’) is an in-built function in excel which allows establishing a relationship between different columns of excel.
Usage of VLOOKUP
We use VLOOKUP when we need to find some information in a large data-spreadsheet, or when we need to search for the same kind of information throughout the spreadsheet. This formula is often used in financial modeling and other types of financial analysis to make models more dynamic and incorporate multiple scenarios.
Experience the power of our Data Science course with a free demo – Enroll now!
VLOOKUP Formula
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
The VLOOKUP function consists of three required arguments, in the following order: lookup value, table array, and column index number.
- Lookup_value (required argument) – The lookup value is the value for which you want to find matching data and must appear in the first column of the lookup table; it can be a value, a text string, or a cell reference.
- Table_array (required argument) – The table array is the data array that is to be searched. The VLOOKUP function searches in the left-most column of this array.
- Col_index_num (required argument) – This is an integer, specifying the number of columns Excel must count over to find the matching value.
- Range_lookup (optional argument) – This defines what this function should return in the event that it does not find an exact match to the lookup_value. The argument can be set to TRUE or FALSE, which means:
- TRUE – If the range lookup argument is TRUE, or if a range lookup argument is not entered, VLOOKUP can find approximate matches. That is, if an exact match is not found, use the closest match below the lookup_value. In this case, the lookup table must be sorted in ascending order by the first column in it; otherwise VLOOKUP may not return the correct value.
- FALSE – If the range lookup argument is FALSE, VLOOKUP will find only exact matches, that is, if an exact match is not found, then it will return an error.
How to use VLOOKUP in Excel?
Organize the data
The first step to effectively using the VLOOKUP function is to make sure your data is well organized and suitable for using the function. VLOOKUP works in a left to right order, so you need to ensure that the information you want to look up is to the left of the corresponding data you want to extract. If the tables are not in order, it will return an error message. This is one of the major drawbacks of VLOOKUP,
Tell the function what to lookup
In this step, we tell Excel what to look for. Type the formula “=VLOOKUP(“ and then select the cell that contains the information we want to lookup).
Tell the function where to look
In this step, we select the table where the data is located, and tell Excel to search in the leftmost column for the information we selected in the previous step.
Tell Excel what column to output the data from
We need to tell Excel which column contains the data that we want to have as an output from the VLOOKUP. To do this, Excel needs a number that corresponds to the column number in the table.
Exact or approximate match
This final step is to tell Excel if you’re looking for an exact or approximate match by entering “True” or “False” in the formula.
Let us have a look at an example:
- In the Formula Bar, type =VLOOKUP().
- In the parentheses, enter your lookup value, followed by a comma. This can be an actual value, or a blank cell that will hold a value: (H2,
- Enter your table array or lookup table, the range of data you want to search, and a comma: (H2,B3:F25,
- Enter column index number. This is the column where you think the answers are, and it must be to the right of your lookup values: (H2,B3:F25,3,
- Enter the range lookup value, either TRUE or FALSE. TRUE finds partial matches, FALSE finds exact matches. Your finished formula looks something like this: =VLOOKUP(H2,B3:F25,3,FALSE)
Looking for a Data Science Career? Explore Here!
Things to remember about the VLOOKUP Function
- When range_lookup is omitted, the VLOOKUP function will allow a non-exact match. However it will use an exact match if one exists.
- If the lookup column contains duplicate values, VLOOKUP will match the first value only.
- The function is not case-sensitive.
- Suppose there’s an existing VLOOKUP formula in a worksheet. In such cases, formulas may break if we insert a column in the table. This is so because, when columns are inserted or deleted, hard-coded column index values don’t change automatically.
- VLOOKUP allows the use of wildcards, e.g., an asterisk (*) or a question mark (?).
- Suppose in the table we are working with the function contains numbers entered as text. If we are simply retrieving numbers as text from a column in a table, it doesn’t matter. But if the first column of the table contains numbers entered as text, we will get an #N/A! error if the lookup value is not also in text form.
- #N/A! error – Occurs if the VLOOKUP function fails to find a match to the supplied lookup_value.
- #REF! error – Occurs if either:
- The col_index_num argument is greater than the number of columns in the supplied table_array; or
- The formula attempted to reference cells that do not exist.
- #VALUE! error – Occurs if either:
- The col_index_num argument is less than 1 or is not recognized as a numeric value; or
- The range_lookup argument is not recognized as one of the logical values TRUE or FALSE.