How to use the Excel VLOOKUP function | Exceljet

VLOOKUP is an excel serve to get data from a table organized vertically. Lookup values must appear in the beginning column of the mesa passed into VLOOKUP. VLOOKUP supports approximate and accurate match, and wildcards ( * ? ) for partial matches .
Vertical data | Column Numbers | Only looks correctly | Matching Modes | Exact Match | Approximate Match | First Match | Wildcard Match | Two-way Lookup | Multiple Criteria | # N/A Errors | Videos


VLOOKUP is credibly the most celebrated function in Excel, for reasons both good and badly. On the good side, VLOOKUP is slowly to use and does something very utilitarian. For new users in finical, it is vastly meet to watch VLOOKUP scan a mesa, find a match, and return a correct consequence. Using VLOOKUP successfully is a ritual of enactment : from novice to skilled Excel drug user .
On the bad side, VLOOKUP is limited and has dangerous defaults. Unlike INDEX and MATCH ( or XLOOKUP ), VLOOKUP needs a complete table with search values in the first column. This makes it hard to use VLOOKUP with multiple criteria. In addition, VLOOKUP ‘s default option match behavior makes it easy to get faulty results. Fear not. The key to using VLOOKUP successfully is mastering the basics. Read on for a complete overview.


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 erect data to look inside. The beginning column of table_array must contain the search values to search. The column_index_num argument is the column number of the measure to retrieve, where the first column of table_array is column 1. last, 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 accurate match. crucial : range_lookup is optional and defaults to TRUE, thus VLOOKUP will perform an approximate catch by default option. See below for more information on match .

V is for vertical

The purpose of VLOOKUP is to look up data 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, think that every column in the table_array is numbered, starting from the leave. To get a measure from a given column, provide the number for column_index_num. For exercise, the column index to retrieve the first name downstairs is 2 :
VLOOKUP is based on column numbers
By changing alone column_index_num, you can look up columns 2, 3, and 4 :

 = VLOOKUP (H3 ,B4:E13, 2, false )  // first diagnose
 = VLOOKUP (H3 ,B4:E13, 3, delusive )  // final name
 = VLOOKUP (H3 ,B4:E13, 4, false )  // electronic mail cover

note : normally, we would use an absolute citation 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 correct. 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 match, accurate and approximate, controlled by the fourth controversy, range_lookup. The word “ range ” in this case refers to “ range of values ” – when range_lookup is TRUE, VLOOKUP will match a compass of values rather than an exact value. A commodity example of this is using VLOOKUP to calculate grades. When range_lookup is FALSE, VLOOKUP performs an claim equal, as in the exemplar above .
authoritative : range_lookup is optional defaults to TRUE. This means approximate match is the nonpayment mode, which can be dangerous. Set range_lookup to FALSE to force accurate match :

 = VLOOKUP (value ,table ,col_index )  // approximate match ( nonpayment )
 = VLOOKUP (value ,table ,col_index, genuine )  // approximate equal
 = VLOOKUP (value ,table ,col_index, fake )  // exact match

tip : constantly supply a measure for range_lookup as a reminder of expected behavior .
note : You can besides supply zero ( 0 ) for an claim match, and 1 for approximate match .

Exact match example

In most cases, you ‘ll credibly want to use VLOOKUP in exact match manner. This makes sense when you have a unique key to use as a search value, for case, the movie title in this datum :
VLOOKUP exact match with movies
The recipe in H6 to find Year, based on an accurate match of movie entitle, is :

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

video : How to use VLOOKUP for exact match

Approximate match example

When you want the best match, not necessarily an demand couple, you ‘ll want to use approximate mode. For exemplar, below we want to look up a commission rate in the mesa G5 : H10. The search values come from column C. In this exercise, we need to use VLOOKUP in estimate match modality, because in most cases an demand match will never be found. The VLOOKUP rule in D5 is configured to perform an approximate match by setting the end argument to TRUE :
VLOOKUP approximate match commission rate

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

VLOOKUP will scan values in column G for the search value. If an exact match is found, VLOOKUP will use it. If not, VLOOKUP will “ step back ” and match the former row. This means table_array must be sorted in ascending ordering by search respect to use approximate match .
caution : If range_lookup is omitted or TRUE and table_array is not sorted by the first column in ascending decree, VLOOKUP may return wrong or unexpected results .
television : How to use VLOOKUP for approximate equal

First match only

In the case of duplicate coordinated values, VLOOKUP will find the first catch. In the screen door below, VLOOKUP is configured to find the price for the color “ green ”. There are three rows with the discolor Green, and VLOOKUP returns the price in the first row, $ 17. The formula in cell F5 is :

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

VLOOKUP returns first match
tip : To retrieve multiple matches in a search operation, see the FILTER function .

Wildcard match

The VLOOKUP affair supports wildcards, which makes it potential to perform a partial match on a search value. For example, you can use VLOOKUP to retrieve information from a mesa with a fond lookup_value and wildcard. To use wildcards with VLOOKUP, you must use claim match modality by providing FALSE for range_lookup. In the screen below, the formula in H7 retrieves the first gear name, “ Michael ”, after typing “ Aya ” into cell H4. Notice the star ( * ) wildcard is concatenated to the search value inside the VLOOKUP formula :

 = VLOOKUP ($H$4 ,$B$5:$E$104, 2, false )

VLOOKUP wildcard match
Read a more detailed explanation here .
television : How to use VLOOKUP for wildcard matches .

Two-way lookup

Inside the VLOOKUP function, column_index_num is normally hard-coded as a electrostatic number. however, you can besides create a moral force column index by using the MATCH serve to locate the want column. This proficiency allows you to create a active two-way search, matching on both rows and column. In the screen below, VLOOKUP is configured to perform a search based on Name and Month. The formula in H6 is :

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

VLOOKUP two-way lookup
For more details, see this exemplar .
video : bipartisan match with VLOOKUP .
note : In general, INDEX and MATCH is a more compromising room to perform bipartite lookups .

Multiple criteria

The VLOOKUP serve does not handle multiple criteria natively. however, you can use a benefactor column to join multiple fields together, and use these fields like multiple criteria inside VLOOKUP. In the case below, Column B is a assistant column that concatenates beginning and survive names together with this formula :

 =C5 &D5  // assistant column

VLOOKUP is configured to do the lapp thing to create a search value. The recipe in H6 is :

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

VLOOKUP with multiple criteria
For details, see this example. For a more advance, 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 erroneousness. The # N/A error means “ not found ”. For example, in the screen door below, the search respect ” Toy Story 2 ” does not exist in the search table, and all three VLOOKUP formulas return # N/A :
VLOOKUP #N/A error example
The # N/A error is utilitarian 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 routine like this :
VLOOKUP #N/A error example - fixed
The recipe in H6 is :

 = IFNA ( VLOOKUP (H4 ,B5:E9, 2, assumed ), `` 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 besides use the IFERROR routine to trap VLOOKUP # N/A errors. however, be careful with IFERROR, because it will catch any error, not precisely the # N/A error .
Read more : VLOOKUP without # N/A errors
video : What to do when VLOOKUP returns # N/A

More about VLOOKUP

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.
generator :
Category : How To

Related Posts

Leave a Reply

Your email address will not be published.