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
0
votes
0 answers

Ordering a bar chart with duplicate values?

I have data I am trying to visualize on a regular cadence. The data looks something like this: SectionA - 2000 SectionB - 600 SectionC - 1300 SectionD - 600 SectionE - 400 An issue I already solved for is the sections being dynamic-ish. While…
0
votes
2 answers

Is there a way to create RDBMS-behavior in Excel for row column lookups?

Is it possible to lookup values in excel in the following method: Table 1 ID | Code ----------------- 1 | I 1 | J 1 | K 2 | I 2 | J 2 | L Table 2 ID | I | J | K | …
JM4
  • 6,740
  • 18
  • 77
  • 125
0
votes
1 answer

trying to Match multiple columns with Vlookup but flawed

=+IF(VLOOKUP(F8,Issue!U:U,1,0)<>"#N/A","Done", IF(VLOOKUP(Q8,Issue!P:P,1,0)<>"#N/A","Done", IF(VLOOKUP(O8,Issue!R:R,1,0)<>"#N/A","Done","#N/A"))) Above formula has been used first branch of vlookup is wrong fine but failed to evaluate others.
0
votes
0 answers

excel vlookup shows #n/a but I see the value is there

I have an excel vlookup and for some reason it always has #n/a even though I can see the search value is there, even when I look at the same table. Could it be an excel version issue, or share drive, or oneDrive? What is wrong with what I'm…
Michele
  • 3,617
  • 12
  • 47
  • 81
0
votes
0 answers

Excel VLOOKUP FUNCTION with multiple lookup values doesn't work

Dear StackOverFlow members, I am running into a problem using the VLOOKUP FUNCTION in Excel. I will give a quick overview of the sheets and the corresponding variable names and values: First sheet: Second Sheet: In the second sheet the export…
0
votes
0 answers

VBA counting error when using lookuprange command

Dim endweek As Long Dim lookuprange As Range Dim resultrange As Range Dim resultcell As Range Dim weeknumber As Long Dim counter As Long Sub updategraphs() startweek = InputBox("Specify the beginning range of the weeks you wish to graph…
0
votes
1 answer

Google sheets transpose google form answers, keeping some variables fixed and others transposed

Im currently trying to make an inventory system where users can check out multiple items at once, via a google form. As such, i want to get all of the inventory data into one column so that i can use vlookup. I am trying to find a way that I can…
0
votes
3 answers

Check multiple strings in one cell against another table to match up values in Excel

For my example, I have a table with one column where each cell has multiple values. To simplify I'll just use colors. In the second Column, I want a Y or N depending on what those colors say in a separate table. If any of the colors listed match up…
C W
  • 11
  • 3
0
votes
0 answers

Count of positive numbers, using a lookup from data in a pivot table

Any suggestions on how best to solve this? I have a pivot table that contains employee IDs with their associated chargeable hours variances on a weekly basis. I can do a simple COUNTIF at the end of each row to total up the number of positive…
0
votes
0 answers

Vlookup items details with lifo method in Excel or Google sheets

I want to lookup the purchase records for a list of items having one quantity each from a data having following fields column a,b,c,d,e as follows item code, quantity, date, invoice number, discount in such a way that it uses the lifo principle but…
0
votes
2 answers

How do i convert this code using VLookUp function?

I am writing a vba code to retrieve a value from a different sheet. so when i press CommandButton2, an InputBox will apppear and user need to input a set of member number, after that the code will the name of the member based on the member number. i…
0
votes
1 answer

pivot returning blank instead of 0 google sheet

I have a spreadsheet where I have an importrange and vlookup to another file where its looking up to a pivot table. Some data is blank in the pivot table and when I lookup in the formula, I have a result of blank even though I have set it to return…
KW Prep
  • 9
  • 2
0
votes
1 answer

Fill Data from DataFrame When 2 Column Values Match

I am trying to populate an empty column dataframe when two conditions (columns ['SITE','week'] are equal) are met when comparing two dataframes. Here is my example: df1_small: week SITE LAL 0 1 BARTON CHAPEL 1.1 1 2 BARTON…
user2100039
  • 1,280
  • 2
  • 16
  • 31
0
votes
1 answer

Vlookup tables to convert unique cell ID to multiple ingredients

I'm wondering if somebody could help me with a problem I'm having with Excel. I have imported a csv file with some business orders, and each row is a different order. Within these orders, there is a cell with a certain product ID, and these are…
0
votes
1 answer

How to reconcile monthly expected vs actual amounts using query and vlookup?

Working on automating the categorisation of my monthly bank statement. Categorisation working well, where I am getting stuck though is reconciling each month with expected amount vs. actual. I do have a workaround in that I use a query to return the…