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

Search for text in table (all columns/rows) and return date/text (Match, Index, VLookup, Filter - HELP!)

I've been driving myslef cracy trying to work this out - which at first appearances seems quite simple. I have a table containing sites at which different surveyors are working on at different dates and times (dusk or dawn). What I've been trying to…
JonR
  • 1
  • 1
0
votes
1 answer

Excel cell value format/encoding messes up vlookup

I am using Excel 2023 (version 2302). Its cell value formatting is messing with vlookup. My numbers come from a CSV file that I imported as US-ASCII, they are parcel numbers such as 100011149032, I am trying to vlookup it in another target range…
For Comment
  • 1,139
  • 4
  • 13
  • 25
0
votes
0 answers

Multiple sheet workbook (3 sheets). Return value from column c from sheet 2. Needs to contain M1 and d2 on sheet1. Xtra vlookup?

Trying to return a value from Column C on the second sheet that Column A on the second sheet is M1 on first sheet and Column B on the second sheet is D2 on the first sheet. Tried vlookup. Too many arguments. Tried SUMIFS. Too big.
0
votes
1 answer

Converting survey response data from columns to rows

I have a set of data that has been exported from a system which is displayed as follows: Data as current I need to have it dsiplayed as one row per respondent, with the questions as columns and the responses as the values: Desired data layout Can…
AA82
  • 3
  • 1
0
votes
0 answers

how to use VLOOKUP in google spreadsheet and microsoft excel

What are the different ways to use Vlookup functions and understand it simply. How to lookup data from two different workbook I could not understand the function to use
Renno Y
  • 9
  • 1
0
votes
1 answer

Extract a word based on a list of words

So I have sheet with data like this in column B: 130 Oneida St 145 Main St 250 Riberia St etc. These ares street addresses which have the house number and street name combined. I have another sheet with list of street names like this in the other…
0
votes
1 answer

I want to run a script to compare two workbooks and validate data from workbook 1 to workbook 2

I am working with a "master" excel (Workbook 1) that has two columns in it. Column A lists "Order Types" and Column B lists "Requirement". My second excel (Workbook 2) will also have "Order Types" in column A. Column B, however, will be blank. I…
Anna
  • 9
  • 2
0
votes
0 answers

Performing a vlookup in VBA using the second dimension of a multi dimensional array

Truly stumped here. Simple example of what I am trying to do. I build a 10 row, 4 column matrix, that goes A1 to C1 on a row and down to "a10" row. I am trying to perform a lookup. The lookup works perfectly well if I look up using the first column…
0
votes
1 answer

How can I use VLookup to match data from 2 sheets onto a 3rd sheet?

On sheetA I have a column of names. On sheetB I have those names in a column paired with an ID. On sheetC I want to have a new column that takes the names from sheetA, matches them with the names on sheetB and returns the relevant ID. I've been…
MeltingDog
  • 14,310
  • 43
  • 165
  • 295
0
votes
3 answers

Evaluation result changes when using ARRAYFORMULA format

I'd like to use the following formula with ARRAYFORMULA: =IF(IFERROR(OR(VLOOKUP($A2, DATA!$A$2:D, 3, FALSE), VLOOKUP($A2, DATA!$A$2:D, 4, FALSE)), FALSE), "SENT", IF(IFERROR(NOT(ISNA(VLOOKUP($A2, REJECTED!$A$2:A, 1, FALSE))), FALSE), "REJECTED",…
dan
  • 347
  • 2
  • 14
0
votes
2 answers

Lookup list of values that partially matches other array and it returns with custom value

I am trying to do any partial matches in the column G with the values from column A. If any of the values from column A matches in column G, the return values is yes. I tried many different lookup functions, but still can't figure it out. Can…
0
votes
0 answers

VLOOKUP to Return Blank cell instead of "0"

I have the following code: Dim prevSht As Worksheet Dim foundCell As Range Dim foundCol As Long Dim findStr As String Dim findRng As Range Set prevSht = Worksheets("Previous_OnPrem") findStr = "Date" Set findRng = prevSht.Range("A:J") Set…
JohnnyHG
  • 11
  • 2
0
votes
0 answers

Significantly different count between Google Sheets and SQL

Getting two different counts between Google sheets and sql. After looking at the v lookup code and the sql code I can’t find any difference in the logic. Main differences is that in the Google sheets a countif is totaling the results of a vlookup…
Drifto000
  • 11
  • 1
0
votes
1 answer

Excel VLOOKUP to extract alphabet postion in name

ANTHONY in this name i want 4th character alphabet position EX: ANT(8) i have to get like this i tried this formula =VLOOKUP(MID(A2,4,1),$J:$K,2,0) i can able to get just position only like 8 but i want result like this ANT(8)
0
votes
1 answer

Is there a formula that i can use to look up a specific value from a column conditioned by values from two other columns from the same table?

I am using google sheets to create a spreadsheet for my university program, and i want to search up a value from a column and it also being conditioned by student name and week ( these values are in separate columns). I want to know if there is a…