Hello Experts,
I need your help to automate a long manual activity which takes allot of time. Every week I have received stock transfer requests of 500 line items from LHR and ISB to replenish the stock from KHI which is our central Warehouse to feed both locations. I have attached an excel file with expected results in columns N and O respectively. The Purpose is to make the distribution with keeping in view the justice and equality. Below are the conditions which I have made and if anyone of you feels that is not logical or need changes you can make changes in the attach excel file while replying to the solution.
Note:
Stock can not be transfer in decimals it has to be a whole number
Below are the logics
1-Since KHI is our mother location so it has to be make sure KHI should not be < its monthly sales no matter LHR and ISB has zero stock
2-If LHR or ISB has current stock = their monthly average sales then no transfer is required no matter quantities are available in KHI
3-Transfer will only be executed if LHR / ISB has < its average monthly sales means if their current deficit < 100
4- if KHI has enough stock to fulfill both LHR/ISB requirement then relenish both upto their max deficit
5- if KHI has only one extra qty and deficit of anyone location is >= 80% then proceed transfer to that location
6- if KHI has only one extra qty and deficit of both location is >= 80% then check whose average sales is higher then otherone then proceed for that location
7- if both locations deficit is equal and KHI available is not enough to satisfy both then the qty will be equally devided equally to both keeping in view of if quantity is ODD then it will be -1 then divided by 2
8- If one has defcit >= 80% and other has <=20% and available stock can completely fullfil the one has higher deficit then all feed to that one and if still have leftover stock in khi then send to other location
9- If one has defcit >= 80% and other has <=20% and khi has not enough to fullfill the one has higher deficit completely then available stock will be splitted in 80-20% respectively
10- If one has defcit >= 60% and other has <=35% and available stock can completely fullfil the one has higher deficit then all feed to that one and if still have leftover stock in khi then send to other location
11- If one has defcit >= 60% and other has <=35% and khi has not enough to fullfill the one has higher deficit completely then available stock will be splitted in 60-35% respectively
12- If one has defcit >= 45% and other has <=35% and khi has not enough to fullfill the one has higher deficit completely then available stock will be splitted in 45-35% respectively
13- If one has defcit >= 45% and other has <=35% and available stock can completely fullfil the one has higher deficit then all feed to that one and if still have leftover stock in khi then send to other location
14- If one has defcit >= 35% and other has <=20% then available stock will be splitted equally keeping in view if quantity is ODD then it will be -1 then divided by 2
15- If one has defcit <= 35% and other has <=20% then available stock will be splitted equally keeping in view of ODD then it will be -1 then divided by 2
Excel file is attached to give you more understanding.
Thanks in advance
Attachment 645989
Bookmarks