

This can be achieved by using the VLOOKUP function with the following parameters: So for the example above we need a function to find the Key coffee from the table in sheet2 and return its price ($5.00) to cell C9:
VLOOKUP IN EXCEL VBA TUTORIAL UPDATE
We need a function in the Unit Price column ( Column C) to update the price based on the value selected in the Item column (Column A). If it is set to True, or not passed at all, VLOOKUP will find a close match.Įxample: Lets say we are trying to create an invoice or bill for the drink orders:

If this parameter is set to false, VLOOKUP will search to find an exact match. =VLOOKUP(Lookup_value, Table_array, Col_index_num, Range_lookup)Ĭol_index_num: The column with the Value to return after finding the matching Key. VLOOKUP: The VLOOKUP function has the following format: Value: The price and preparation time are the value fields. Note: The column with the Key values must be the first column. For example you can’t look up the price $4.00 and find a unique drink (there are 2 drinks associated with that price). On the other hand the price and p preparation times are not necessarily unique. By looking up the name of the drink you can find its price and preparation time in the table. Each drink has a unique name, therefore the drink name is a key. Key: In this table there are different drinks. Table: The table is from cell A2 to cell C8. This could be a number, a string, a date, … as long as it is unique to that record.Įxample: As an example take a look at the table below: Table: A set of records, where each record has a unique Key. Upon finding the Key it returns the requested value associated with that Key. In short VLOOKUP searches a table of data for a specific Key. In this article I will explain the function VLOOKUP.
