Problem
I need the values from the right table fill into the left one.In the sample table I need to fill the column "Price per item" by prizes from the small table on the right side (in this sample I am not interested in the column "Revenue at all" and I will pretend it does not exist).
For example to item "chocolate" I want to write the price 12, which is related to chocolate.
I can do it manually here, but it is impossible in case of large table.
Solution
Function VLOOKUP will help me.
I will write into F5:
=VLOOKUP(B5;H7:I11;2)
because:
- All functions start with "="
- "VLOOKUP" is the name of the function
- "B5" because there is the word "chocolate" in B5 - the word, used by Excel to find the relevant price
- "H7:I11" because in this area is the small table situated (table, from which the values are taken)
- "2" because from the small table we need to get the value, which is in the second column (column "Price per item")

Before I can the function, written into F5, expand to other rows, I have to complete it with absolute cell references.
=VLOOKUP(B5;$H$7:$I$11;2)
I made absolute the second cell reference, referring to the table, from which are the values taken. It is because this table will stay stable for all rows and it is not supposed to be changed by expanding.
And here is the result (after easy completing of the "Revenue at all" column).
Notes:
- If the table, form which are the values taken, would be transponed (just like the table right beside the final table), we would use function SLOOKUP instead of function VLOOKUP and in the third parameter there would be the number of row instead of number of column (however, in our example are both "2")
- How to remember names of this functions? "V" is like "vertical" and "H" is like "horizontal".
- These function are similar to "joining" queries in databases, which we can not use in Excel usually.
- If this function does not work properly, arrange the values in small table according to alphabet.
No comments:
Post a Comment