At times we may end in searching a value in column of a sheet with other
column in the same sheet or a different sheet. Here VLookup is function that is
so useful to identify the value. The
most common definition available in internet is “Searches for a value in
the first column of a table array and returns a value in the same row from
another column in the table array”. The meaning of the sentence is we need to
identify a value of a cell in one column from the other column in the same row.
VLookup represents vertical lookup.
Syntax
VLOOKUP(<lookup value>,<table
array>,< Column index number>,<range lookup>)
- Lookup value is the value to search in the first column of the table array. Lookup_value can be a value or a reference. If lookup_value is smaller than the smallest value in the first column of table_array, VLOOKUP returns the #N/A error value.
- Table array may contain two or more columns of data. Use a reference to a range or a range name. The values in the first column of table array are the values searched by lookup value. These values can be text, numbers, or logical values. Uppercase and lowercase texts are equivalent.
- Column index number The column number in table_array from which the matching value must be returned. A Column index number of 1 returns the value in the first column in table_array; a Column index number of 2 returns the value in the second column in table array, and so on. If Column index number is:Less than 1, VLOOKUP returns the #VALUE! error value.Greater than the number of columns in table_array, VLOOKUP returns the #REF! error value.
- Range lookup A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match:If TRUE or omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned.The values in the first column of table array must be placed in ascending sort order; otherwise, VLOOKUP may not give the correct value.If FALSE, VLOOKUP will only find an exact match. In this case, the values in the first column of table_array do not need to be sorted. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, the error value #N/A is returned.
Example:
Here in this example I will use a sample Order Table with the Product
table. Our intention is used to find the Product name from the product id from
the Order table for Order Detail table.
A
|
B
|
C
|
Order
|
||
Customer Name
|
Order ID
|
Product Code
|
Cameron White
|
1
|
AT123
|
James Peterson
|
2
|
BG456
|
Andrew Thomas
|
3
|
BT456
|
James Peterson
|
4
|
CY956
|
Jason Taylor
|
5
|
DR098
|
James Peterson
|
6
|
BT456
|
Michel Adams
|
7
|
CY956
|
A
|
B
|
Product
|
|
Product Code
|
Product Name
|
AT123
|
Amber Light
|
BG456
|
Big Plug
|
BT456
|
Big Tatoo
|
CY956
|
Crimson yarn
|
DR098
|
Digital Diary
|
BG456
|
Big Plug
|
CY956
|
Crimson yarn
|
From the both these table we need to achieve the below result
A
|
B
|
Order Detail
|
|
Customer Name
|
Product Code
|
Cameron White
|
Amber Light
|
James Peterson
|
Big Plug
|
Andrew Thomas
|
Big Tatoo
|
James Peterson
|
Crimson yarn
|
Jason Taylor
|
Digital Diary
|
James Peterson
|
Big Tatoo
|
Michel Adams
|
Crimson yarn
|
Type the formula “=VLOOKUP (C4, A14:B21, 2, FALSE)” this
Formula (fx) textbox in the excel document
C4 – Lookup value
A14:B21 – It is the table array in the order detail table
2 – Column Index
False – It is the exact match of the lookup value.
Then drag the cell till the end of the row and see the result.
Please your queries on this post and I will get to this very soon.
