Calculating total demands from two tables

mazigazi

New Member
Joined
Dec 5, 2022
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Greetings,

I am somewhat lost how to approach this problem that I have. In essence I want to calculate demands per material for specific date based on the number of projects on that date. for this I have 3 tables

Project Consumption Table (showing how much of each material is consumed for each project):
MaterialProject AProject B
Material 1105
Material 231
Please note that new projects and material will be added in the future and the table will update accordingly.

Production Plan Table (shows how many times are the projects being produced on a specific date):
Project1.1.20231.2.20231.3.2023
Project A123
Project B203
This table shows how many times a specific project will be produced on that day. As with the project consumption table it is updated with new projects.

Material Demands table is where I need calculation help (Total material demands on specific date):
Material1.1.20231.2.20231.3.2023
Material 1Formula? Result would be 202045
Material 25612
I would love to have an elegant solution without summing different lookups (eg. Index match match + index match match) as in reality there are multiple dozens of different projects and hundreds of materials, so preferably adding new projects and materials to tables would not "break" the formula. I believe it should be possible to achieve this with a clever use of SUMPRODUCT, but I have rarely used it, so I don't know how to approach it.

If you need any additional info I'd be glad to provide it.

Thanks so much for your help!
Mazi
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You can do this using Power Query, if you re-arrange the first two tables a bit. Then it's a Full Outer merge on Project between them, yielding a table that has a line for each material-date combination, and then it's just calculations.

Book1
ABCDEFGHI
1Consumption
2MaterialProjectPer projectMaterialProjectPer projectDateNumber
3Material 1Project A10Material 1Project A1001/01/20232
4Material 2Project A3Material 1Project A1001/02/20232
5Material 1Project B5Material 1Project A1001/03/20233
6Material 2Project B1Material 2Project A301/01/20232
7Material 2Project A301/02/20232
8PlanMaterial 2Project A301/03/20233
9ProjectDateNumberMaterial 1Project B501/01/20232
10Project A01/01/20232Material 1Project B501/02/20230
11Project A01/02/20232Material 2Project B101/01/20232
12Project A01/03/20233Material 2Project B101/02/20230
13Project B01/01/20232Material 1Project B501/03/20233
14Project B01/02/20230Material 2Project B101/03/20233
15Project B01/03/20233
Sheet3
 
Upvote 0
You can do this using Power Query, if you re-arrange the first two tables a bit. Then it's a Full Outer merge on Project between them, yielding a table that has a line for each material-date combination, and then it's just calculations.

Book1
ABCDEFGHI
1Consumption
2MaterialProjectPer projectMaterialProjectPer projectDateNumber
3Material 1Project A10Material 1Project A1001/01/20232
4Material 2Project A3Material 1Project A1001/02/20232
5Material 1Project B5Material 1Project A1001/03/20233
6Material 2Project B1Material 2Project A301/01/20232
7Material 2Project A301/02/20232
8PlanMaterial 2Project A301/03/20233
9ProjectDateNumberMaterial 1Project B501/01/20232
10Project A01/01/20232Material 1Project B501/02/20230
11Project A01/02/20232Material 2Project B101/01/20232
12Project A01/03/20233Material 2Project B101/02/20230
13Project B01/01/20232Material 1Project B501/03/20233
14Project B01/02/20230Material 2Project B101/03/20233
15Project B01/03/20233
Sheet3
This would be a possible solution, however I would wish to avoid Power Query, to have a lean live solution and to be able to input some additional logic to demand table (One-Time event demands, scrap based on supply etc.)
 
Upvote 0
Also, headers with dates are dynamic always showing from - 6 months to +36 months, which you cannot have in "real table" headers.
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,148
Members
452,615
Latest member
bogeys2birdies

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