lundi 1 avril 2019

how to recursively calculate supply-demand-type problem when there are multiple of Demands on one tab and few Supplies on the other

i have 2 tabs, one has rows of demand for one Product (ex 5pcs, 10 pcs,..) while second tab has Supply (ie Jobs for 100 pcs, 50 ...). How to create one spreadsheet that would summarize how much of Demand will be satisfied by Supply, and when 1st supply is consumed, to show next Supply available, or show that none is available at all.

I have tried using Vlookup, but it only works for the first line of code, as soon as i copy it to the next line of Demand, the 2nd tab's Supply moves down also, but it should stay on the 1st record until Qty gets depleted, and only then move to the next record.

Example: Product A has requirements for 5, 10 and 20 pcs. I have job111 for 20 pcs and job 222 for 30 pcs. The output should say that 5pcs and 10 pcs are covered by job111, but 20 pcs are covered by part job 111 and part job 222.

if to show partial is too difficult, i don't mind simply skipping the "leftover" and moving on to the next job222. When no more jobs are available, it should display message "no Supply"

Aucun commentaire:

Enregistrer un commentaire