Questions tagged [vlookup]

VLookup is a Microsoft Excel function that searches for a value in the left-most column of a table array (a range), and returns a value in the same row based on the column number from which the user wishes to retrieve the value.

Usage

Click on an empty cell in Microsoft Excel and type =VLOOKUP. Click the fx icon to view interactive help that will assist you in filling out the parameters, or fill out the parameters as follows:

=VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)

lookup_value: This should be either a literal value like 12 or "hello", or any function that returns a reference to a single cell. Do not try to use a Range here; if you think you need a range here, you probably need to use a different worksheet function.

table_array: This should be a rectangular array of cells containing at least two columns (a "key" column and a "value" column). The leftmost column in the table array is where Excel will look for the value specified by the lookup_value parameter (see above). The "value" column will be read from in the first row where the lookup_value is found in the "key" column. This read value will then be returned as the result of the VLOOKUP() function.

col_index_number: This should be a number greater than 0. If the value is 1, the VLOOKUP() function will return values from the leftmost column in the table_array range. If the value is 2, it will return values from the next column to the right, and so on. Do not specify negative values, values less than 1, or values greater than the total number of columns in table_array.

range_lookup: This parameter can be omitted, otherwise it must be TRUE or FALSE. If TRUE or omitted, an approximate match is returned. In other words, if an exact match is not found, the next largest value that is less than lookup_value is returned. If FALSE, VLOOKUP will find an exact match.

Pitfalls

  • If you need to return multiple values (summed, counted, or otherwise aggregated) from the table_array for one individual row, you need to use another worksheet function, such as SUMIF() or SUMIFS(). You can also use a pivot table for this functionality.

  • If you need multiple lookup_values for a single row, you need to use another worksheet function or set of conditionals.

Alternatives

The most versatile alternative is a combination of INDEX and MATCH.

=INDEX ( array , row number )
=MATCH (  lookup value , lookup array , match type )
=INDEX( array, MATCH( lookup value, lookup array, match type)

Simply put - INDEX(column to return, MATCH( lookup value, lookup array, match type)). This will lookup the matching row for the index column.

You can reverse it like this =INDEX(MATCH(lookup value, lookup array, matchtype), row to return) which looks up the matching column for the index row

Version Support

VLOOKUP() is known to be supported from at least Microsoft Excel 95 (version 7.0), perhaps earlier, up through and including the latest version as of this writing, Excel 2013. It is also supported on Mac OS X versions of Office.

See Also

  1. HLOOKUP, the horizontal equivalent of VLOOKUP with very similar functionality except the role of rows and columns is reversed.

References

  1. Microsoft Office Help article on VLOOKUP
518 questions
24
votes
4 answers

Excel VLOOKUP by second column using table name as range

Using the example table below, I can use the formula =VLOOKUP("ABC123456",Table1,3,FALSE) to lookup the Demand value, but I want to do be able to perform the lookup by using the Cust Part field without having to make the Cust Part field the first…
Drew Chapin
  • 6,270
24
votes
3 answers

Quick replace #N/A by 0 when vlookup

I use vlookup a lot in excel. The problem is with #N/A value when the seek value is not found. In that case, we often replace it by 0 using if(isna(vlookup(what,range,column,false));0; vlookup(what,range,column;false)) which repeat…
Nam G VU
  • 12,548
22
votes
4 answers

Excel - How to vlookup to return multiple values?

I'm looking to use Excel to look up and return multiple reference values for a given key. VLookup does something very similar to what I need - but only returns a single match. I assume it'll involve array-returning and handling methods, though I…
overflew
  • 333
17
votes
7 answers

How to get VLOOKUP to return the *last* match?

I'm used to working with VLOOKUP but this time I have a challenge. I don't want the first matching value, but the last. How? (I'm working with LibreOffice Calc but an MS Excel solution ought to be equally useful.) The reason is that I have two text…
12
votes
3 answers

Searching for a value in Excel, returning yes or no

I have one workbook, with two separate worksheets. I want to know if the values that appear in worksheet B also appear in worksheet A, if so, I want to return a "YES". If not, I want to return a "NO". (Example: Worksheet A is a list of overdue…
8
votes
2 answers

Working with "~" in excel

I have a data set that has names that contain ~ within them. Unfortunately, I cannot find a way to filter or incorporate these cells in a formula. For example, I tried to use a text cell that had ~ within the name, but I would receive a #N/A error.…
8
votes
5 answers

Return list of all values that match criteria

I am trying to help my boss set up an Excel sheet but I am not too familiar. I am looking to list all values of a cell that match a criteria. Sheet 1 A B 1 Adam 4 2 Dave 4 3 Steve 3 4 Ryan 4 What I want is to return a list of all…
29560
  • 89
7
votes
2 answers

Extract values from a range that are missing from another

I've got two columns in Excel, "ROSTER" and "PRESENT", shown below: Is there a formula to achieve the "NOT HERE" column? I tried using VLOOKUP() and https://superuser.com/a/289653/135912 to no avail =( Any help would be appreciated! Thanks!
Kevin Hua
  • 300
7
votes
1 answer

VLOOKUP returns values for some Lookup values but not others

I'm not sure why VLOOKUP isn't returning the value. I have confirmed that I'm using the VLOOKUP correctly and that both values 1 and 2 are a match (no leading/trailing values, etc). Does anyone know what I could be doing wrong? Edit: I am using…
6
votes
4 answers

Excel INDEX MATCH Checking Multiple Columns

The problem I'm essentially trying to solve is a VLOOKUP that is checking Columns A:E for a value, and returning the value held in Column F should it be found in any of these. With VLOOKUP not being up to the task I have looked into the INDEX-MATCH…
6
votes
2 answers

Range mapping in Excel

I have a column of data in Excel with numbers [0..100]. I need a new column, which maps these to a new set of values such that: > 90 : 4 80-90 : 3 70-79 : 2 60-69 : 1 < 60 : 0 I attempted to do this with VLOOKUP, specifically with a test input of…
5
votes
5 answers

How do I prevent VLOOKUP from breaking after I add a column to a named range?

My Excel worksheet contains a lot of VLOOKUPs on a named range that I have defined. Now, when I added a column in the middle of my named range, the VLOOKUPs that reference columns after the inserted column are now broken. I understand the problem,…
bsh152s
  • 191
5
votes
2 answers

In Excel how can I search for #N/A cells?

I'm trying to go to the first instance of a #N/A cell, the result of a VLookup that failed. I know I can conditionally change the value when the result is #N/A, but what I want to do is just locate the specific cell that failed.
4
votes
3 answers

Excel: VLOOKUP and INDEX+MATCH return #REF

I am trying to make cells in one sheet look up a name in another sheet, and return the value one column to the right of the cell with the name. In itself, a perfect job for VLOOKUP. But, when I implement this in practice, with the formula…
Gipphe
  • 141
  • 1
  • 4
4
votes
4 answers

Find alike data in two worksheets to populate a 3rd worksheet?

What is the best/easiest way to combine data from two different Excel spreadsheets into a third Excel spreadsheet? Spreadsheet 1 will have the username only. Spreadsheet 2 would have lots of information e.g. first name, last name, department,…
CSF
  • 41
1
2 3
34 35