Design of database built on 2 tables

regresss

Board Regular
Joined
May 20, 2015
Messages
68
Hello!

There are two input tables. Input 1 is a schema (e.g. what can be bought) which is followed by entry table in input 2 (e.g. what was bought).

db_design.jpg



How to read
If key is Bob, then there are 3 variables named apple, pear and orange. Now using the schema Bob, we placed an order for 20 apples, (blank) pears and 50 oranges in country EU and city Amsterdam. As the Bob schema has only 3 variables, the fourth column value_6 is not applicable.



Idea
01 I can use VBA to add value_i behind name column in input 1, something like if order_t <> order_t-1, then value_i and i=i+1, "". Now I can attribute value to variable name.
02 Go from right to left in input 2 table and find the first non-empty value. Then number of columns till the end of table minus 2 to get a number of rows for each input 2 entry.
03 Hardcode names behind value_1 and value_2 which are static
04 Not sure how to bring it all together



Looking forward to hearing your suggestions. I prefer simple design.
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top