Questions tagged [vlookup]

VLOOKUP is a Spreadsheet function for retrieving a value from an array using a vertical lookup value and a positive column offset. Use with [excel-formula] or [google-sheets-formula] or any other product that supports such lookup

VLOOKUP is a Spreadsheet function for retrieving a value from a table array using a lookup value and a column offset.

There are four arguments to the VLOOKUP function:

  1. lookup_value - the value being searched for. This value must be located in the leftmost column of the table array in order to return a result.
  2. table_array - a range or array of values being searched for the lookup value. This argument can be a range (ex: A1:D10) or a text array (ex: {"ABC","DEF"}).
  3. col_index_num - a number setting the column of the array from which the corresponding value to be returned from the corresponding row that the lookup value is obtained from.
  4. range_lookup - TRUE or FALSE (or their numeric equivalents of 1 or 0) respectively) indicating whether the lookup is for an exact match, or closest value to the lookup value sorted in ascending order. This argument can also be a cell reference (which may contain a formula) which returns one of the above values.

It may be used on the worksheet as well as in by calling the Application.WorksheetFunction.VLookup Function or just Application.VLookup.

Related Tags:


Links:

Issues with VLOOKUP are often from one or more of the following causes:

  1. Attempting to “look to the left” – see emboldened text at 1. above. A col_index_num of 0 or less returns #VALUE! and the range for the table_array cannot be reversed within the formula (D10:A1 is treated as A1:D10). Solutions here may be to rearrange the columns (by either copying, ie a ‘helper column’, or moving the lookup_value column to the left) or to apply the INDEX/MATCH combination instead (example).

  2. Seeking a value that is not in the table_array, probably returning #N/A, or Error 2042 in VBA. Formatting (a text ‘1’ is not the same as a numeric 1) and trailing spaces, for example, may give the appearance that a lookup_value exists in the table_array when it does not. A simple way to check for this is to copy the search value onto the position in the table_array where a match is expected.

  3. Seeking a value that is outside the table_array range. This can happen when a VLOOKUP formula is copied down that refers to a stacked (columnar) range to be searched that is not an entire column and that has not been anchored (set with $s preceding row numbers) or defined as a Named Range. (example (for COUNTIFS)).

  4. Applying the wrong col_index_num, which is one-based. With a table_array, of say a column of numbers on the left and colour names immediately to the right, to return a colour name based on a lookup_value that is a number then the relevant col_index_num is 2.

  5. Failing to add 0 (or FALSE) as the fourth parameter. range_lookup is optional and defaults to TRUE (or 1) if not specified. This makes the assumption that the table_array is sorted in ascending order and applies a binary search for speed and efficiency. Where the fourth parameter for VLOOKUP is not specified and the table_array is not sorted in ascending order an incorrect result, but often plausible in appearance, is very probable.

VLOOKUP does not provide an all results of lookup in a array. If, for example, various shades of red were all assigned the same numeric code in the table_array a numeric lookup_value would, at most, find only one instance (the first, say ‘pink’). Sometimes this may be resolved to find a single result (but say ‘scarlet’ instead of ‘pink’) with a concatenated field in the table_array, and creation of a ‘key’ to suit. (example). Another case where this approach may suit is if there are several different people with the same surname - so the key might be to combine surname with a first name.

4398 questions
11
votes
2 answers

Vlookup using 2 columns to reference another

I am trying to do a vlookup under a circumstance of first then last name to get an age. This will be done within Column A, then Column B. If found in Column A, Continue to Column B, If found in Column B, put age in J3 that comes from Column C else…
Brad
  • 1,450
  • 2
  • 16
  • 37
9
votes
4 answers

Convert three letter country codes to full country names

I need to convert a few hundred three letter country codes (ISO 3166-1 alpha-3) to their full country name in MS EXCEL. I imagine this can be done with a VLOOKUP formula, does anyone have it handy?
Holly
  • 7,462
  • 23
  • 86
  • 140
9
votes
1 answer

Excel VLOOKUP gives wrong value

I have a VLookup cell which gives me the wrong value: This is the table: PID Product Price User User name Deal On Amount After in 1001 table 1001 1 Milly No 1000 in 1001 table 100 13 Vernetta Yes 900 out 1001 …
Nitay
  • 4,193
  • 6
  • 33
  • 42
8
votes
2 answers

Find the last non empty cell ADDRESS without VBA

I need to find the last non empty cell in an Excel spreadsheet, but I need its address, not its value. For example: When I want the value for the last non empty cell in column K, I use this formula: =LOOKUP(2;1/(NOT(ISBLANK(K:K)));K:K) My problem…
Spartacus Rocha
  • 546
  • 1
  • 6
  • 14
8
votes
2 answers

SQL version of VLOOKUP

I am new to SQL and if you have a spare moment, I was wondering whether anybody could help me replicate the Excel Vlookup function in SQL please? From some research, I am suspecting that it is one of the join functions that I require, however, I…
user3715274
  • 81
  • 1
  • 1
  • 2
8
votes
3 answers

Merge multiple Excel workbooks based on key column

I get seven workbooks (xlsx files) from different clients, each with one sheet. Each sheet has at least one common ID column (UNIQ, PK). One of the workbook contains list of all possible ids. Others may not have record for all ids, but each row has…
Annie
  • 3,090
  • 9
  • 36
  • 74
8
votes
5 answers

VLookup type method in R

I have a df with thousands of tickers for different future contracts. They have the abbreviated name (which appears later) and the long name (which I want to have in other df) full_list <- structure( list( Ticker = c("AC", "AIC", "BBS", "BO",…
Tim
  • 776
  • 3
  • 8
  • 15
7
votes
5 answers

VLOOKUP and Interpolating

I am trying to check a table for specific data and if i found the data it will display the data. I did that with VLOOKUP. But now if the data is not in the table i want to interpolate between two sets of data. But i have no idea how to do it. So…
user2737015
  • 79
  • 1
  • 1
  • 5
7
votes
1 answer

How to filter an Excel table based on values in a column shard with another table?

To start, I don't think VLOOKUP will work for me because I have dozens of columns in each table. Let's say I have Table 1: Serial# Value1 Value2 Value3 Value4 1 4 34 65 23 2 123 43 54 46 …
SGHAF
  • 105
  • 1
  • 1
  • 5
7
votes
2 answers

How to find location based on IP address in Excel

I've got a spreadsheet of about 5000 user events associated with IPs, and I'm trying to use IP to determine location using just an Excel formula. The IPs in my log are structured as "dotted quads" (decimal notation). I figured VLOOKUP is the way to…
samthebrand
  • 3,020
  • 7
  • 41
  • 56
6
votes
1 answer

Conditional formatting using formula "Vlookup" in google sheet

There is a table of values in sheet 1 which I want to conditionally format(Highlight the cells in color if the nested value finds a match in the table of sheet 2). But it seems like vlookup function couldn't be used in combination with conditional…
John Huang
  • 308
  • 1
  • 3
  • 11
6
votes
2 answers

How to import data from one sheet to another

I have two different work sheets in excel with the same headings in in all the row 1 cells(a1 = id, b1 = name, c1 = price). My question is, is there a way to import data(like the name) from 1 worksheet to the other where the "id" is the same in both…
Hip Hip Array
  • 4,665
  • 11
  • 49
  • 80
6
votes
1 answer

Excel - VLOOKUP vs. INDEX/MATCH - Which is better?

I understand how to use each method: VLOOKUP (or HLOOKUP) vs. INDEX/MATCH. I'm looking for differences between them not in terms of personal preference, but primarily in the following areas: Is there something that one method can do that the other…
ImaginaryHuman072889
  • 4,953
  • 7
  • 19
  • 51
6
votes
6 answers

Excel VLOOKUP returning same value in all rows

The vlookup function appears to be broken. It is returning the same value for all lookups, but it should not. I have it set like so: =VLOOKUP(A3, Asset_Mapping!A$2:B$673, 1) Where the lookup value is in the B column and the result is in the A…
Alexx
  • 3,572
  • 6
  • 32
  • 39
6
votes
2 answers

Oracle: VLOOKUP Equivalent

I have a view like this: col_1 col_2 my_date ----- ----- ------- 1 5 2011 2 6 2014 3 7 2012 4 8 2011 And a table like this: date_1 date_2 the_value ------ ------ --------- 2010 2012 v1 2013 …
Vahid
  • 3,384
  • 2
  • 35
  • 69