The VLOOKUP function is a powerful tool in Excel
The VLOOKUP function is a powerful tool in Excel
VLOOKUP Syntax
Excel
Copy code
=VLOOKUP(lookup value,
table array, col index num, [range lookup])
Arguments
- lookup value: The value you want to search for. This can be a value, a cell reference, or a text string.
- table array: The range of cells that contains the data. The first column of this range is where Excel will search for the lookup value.
- col index num: The column number in the table array from which to retrieve the value. The first column of the table array is 1, the second column is 2, and so on.
- range lookup: An optional argument that determines whether you want an exact match or an approximate match:
- TRUE or omitted: Finds an approximate
match. If an exact match is not found, the next largest value less than
the lookup value is returned. The first column of the table array must be
sorted in ascending order.
- FALSE: Finds an exact match. If an exact
match is not found, the function returns #N/A.
Example of VLOOKUP
Imagine you have a
table of data like this:
YouTube video:- https://youtu.be/ZJukF2guPYYsi=S6R5HLnvBZgtUSDb
Basic VLOOKUP Example
You want to find the
price of the product with ID 102.
- lookup value: H4
- table array: B3:F13
(assuming your data
starts from cell B3:F13)
- col index num: 3 (since Price is in the third column of
your table array)
- range lookup: FALSE (you want an exact match)
The formula would be:
Excel
Copy code
=VLOOKUP(H4,B3:F13,3, FALSE)
This formula searches for the value 102 in the first column of the range B3:F13
and returns the value
from the third column in the same row, which is GHR.MATT.
Using Cell
References
You can also use cell
references for the lookup value. If the value H4 is in cell B7, the formula
would be:
Excel
Copy code
=VLOOKUP(H5,B3:F13,3, FALSE)
Approximate Match
If you want to find an
approximate match (useful for looking up ranges of values), you can set the range
lookup to TRUE or omit it. For example, if your table array is sorted in
ascending order by Product ID and you want to find the price for the nearest
match to PUNCH.MATT, you can use:
Excel
Copy code
=VLOOKUP(H5,B3:F13,3, FALSE)
This will return PUNCH.MATT since OPAL GREY is the largest value less than OPAL GREY.0.
Instagram:- https://www.instagram.com/jemal_knowledge?igsh=ZXVhcTFrZ2V2ZmVh
Common Errors
- #N/A: Occurs when the function cannot find the lookup value in the
first column of the table array.
- #REF!: Occurs when the col index num is greater than the number of
columns in the table array.
- #VALUE!: Occurs if the col index num is less than 1.
Tips
- Ensure the first column of the table array
is sorted in ascending order if using an approximate match (TRUE or
omitted).
- Use FALSE for range lookup if you need an
exact match.
- Make sure your table array covers all
columns you might reference with col index num.
Comments
Post a Comment