Search code examples
excelexcel-formulavlookupworksheet-function

Relational coding


I have two Excel sheets. There are some materials with their prices in the first sheet and each material has a code. In the second sheet we have some products. Each product needs one or more than one material (as in the first sheet).

I want to connect these sheets. I should be able to enter the material code in the second sheet and the name of the material should appear automatically. Also I'm entering the quantity of materials for each product and the cost should be calculated too.

Note:
I'm a programmer and know that this is so easy to handle in Access. But I want to do it in MS Excel.


Solution

  • With a layout as shown in the example and the range in Sheet1 named array =VLOOKUP(A2,array,2,FALSE) should show in ColumnC the value from the Sheet1 cell immediately to the right of the value as specified in A2 (of Sheet2). The same formula in D2 with ,2, replaced ,3, should give the corresponding unit price, so appending *B2 should give the Cost. Both formulae may be copied down to suit:

    enter image description here