Hello If the value is equal to 12 in the qty column then I need to divide the qty column to the MinQ column. The result will be spreading in the desired output until the total qty for each dest id between the March 3 and March 12 is equal the sum of If the desired value. If the qty is not equal 12, then I will keep the same value in the desired output. For example, dest id is 13827 and qty is 12 on March 8 and the desired output will start from March 8 as 4 pcs and keep continue until March 10 as 4 pcs so the total of the desired value 12 The other example, if 12 in the qty column comes at the end of the dest id then the output has to be spread out earlier than March 12 For example, Dest id is 15007. There are two 12 inputs in different place of the qty column and the one is in the middle and the other one is at the end of the column so the 12 which is at the end of the column should start earlier March 10 because they have to refer 15007 Dest id. Thank you for your help Input dest_id item ScheduledArrivalDate qty MinQ 13827 400003 03Mar2019 0 3 13827 400003 04Mar2019 0 3 13827 400003 05Mar2019 0 3 13827 400003 06Mar2019 0 3 13827 400003 07Mar2019 0 3 13827 400003 08Mar2019 12 3 13827 400003 09Mar2019 0 3 13827 400003 10Mar2019 0 3 13827 400003 11Mar2019 0 3 13827 400003 12Mar2019 0 3 15007 400003 03Mar2019 0 3 15007 400003 04Mar2019 0 3 15007 400003 05Mar2019 12 3 15007 400003 06Mar2019 0 3 15007 400003 07Mar2019 0 3 15007 400003 08Mar2019 0 3 15007 400003 09Mar2019 0 3 15007 400003 10Mar2019 0 3 15007 400003 11Mar2019 0 3 15007 400003 12Mar2019 12 3 Desired Output dest_id item ScheduledArrivalDate qty MinQ Desired Output 13827 400003 03Mar2019 0 3 0 13827 400003 04Mar2019 0 3 0 13827 400003 05Mar2019 0 3 0 13827 400003 06Mar2019 0 3 0 13827 400003 07Mar2019 0 3 0 13827 400003 08Mar2019 12 3 4 13827 400003 09Mar2019 0 3 4 13827 400003 10Mar2019 0 3 4 13827 400003 11Mar2019 0 3 0 13827 400003 12Mar2019 0 3 0 15007 400003 03Mar2019 0 3 0 15007 400003 04Mar2019 0 3 0 15007 400003 05Mar2019 12 3 4 15007 400003 06Mar2019 0 3 4 15007 400003 07Mar2019 0 3 4 15007 400003 08Mar2019 0 3 0 15007 400003 09Mar2019 0 3 0 15007 400003 10Mar2019 0 3 4 15007 400003 11Mar2019 0 3 4 15007 400003 12Mar2019 12 3 4
... View more