# Excel VLOOKUP Function

VLOOKUP is an Excel function to lookup and retrieve data from a specific column in table. VLOOKUP supports approximate and exact matching, and wildcards (* ?) for partial matches. The "V" stands for "vertical". Lookup values must appear in the first column of the table, with lookup columns to the right.

**value**- The value to look for in the first column of a table.**table**- The table from which to retrieve a value.**col_index**- The column in the table from which to retrieve a value.**range_lookup**- [optional] TRUE = approximate match (default). FALSE = exact match.

VLOOKUP is designed to retrieve data in a table organized into vertical rows, where each row represents a new record. The "V" in VLOOKUP stands for vertical:

If you have data organized horizontally, use the HLOOKUP function.

#### VLOOKUP only looks right

VLOOKUP requires a lookup table with lookup values in the left-most column. The data you want to retrieve (result values) can appear in any column to the right:

#### VLOOKUP retrieves data based on column number

When you use VLOOKUP, imagine that every column in the table is numbered, starting from the left. To get a value from a particular column, provide the appropriate number as the "column index". For example, the column index to retrieve first name below is 2:

#### VLOOKUP has two matching modes, exact and approximate

VLOOKUP has two modes of matching: exact and approximate, which are controlled by the 4th argument, called "range_lookup". Set range_lookup to FALSE to force exact matching, and TRUE for approximate matching.

*Important: range_lookup defaults to TRUE, so VLOOKUP will use approximate matching by default:*

### Example 1: Exact match

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:

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

### Example 2: Approximate match

In cases 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(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.

*Note: data must be sorted in ascending order by lookup value when you use approximate match mode with VLOOKUP.*

### VLOOKUP and #N/A errors

If you use VLOOKUP you will inevitably run into the #N/A error. The #N/A error just means "not found". In practice, there are many reasons why you might see this error. Among the most common:

- 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, but the table reference is not locked

For example, in the example below, the lookup value "Toy Story 2" does not exist in the lookup table, and all three VLOOKUP formulas return #N/A:

One way to "trap" the NA error is to use the IFNA function:

The formula in H6 is:

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:

*Note: In many cases the #N/A is useful because it tells you something is wrong. Read more here about handling VLOOKUP #N/A errors *

### More about VLOOKUP

- Detailed VLOOKUP examples
- 23 things you should know about VLOOKUP
- How to find the first or last match

### Other notes

**Range_lookup**controls whether**value**needs to match exactly or not. The default is TRUE = allow non-exact match.- Set
**range_lookup**to FALSE to*require*an exact match and TRUE to*allow a non-exact match*. - If
**range_lookup**is TRUE (the default setting), a non-exact match will cause the VLOOKUP function to match the nearest value in the table that is*still less than*.**value** - When
**range_lookup**is omitted, the VLOOKUP function will allow a non-exact match, but it__will use__an exact match if one exists. - If
**range_lookup**is TRUE (the default setting) make sure that lookup values in the first row of the table are sorted in ascending order. Otherwise, VLOOKUP may return an incorrect or unexpected value. - If
**range_lookup**is FALSE (require exact match), values in the first column of**table**do not need to be sorted.

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.