I am having two source files One is having Inventory for that particular code and other is having location. So I want to allocate the inventory to different locations based on their needs. I want to take running total of "Stock available " column and allot the nearest value to a location in "Approved " column. Also I want that no value from the stock available should be repeated.
Source 1

Source 2 is attached file
Output should be the highlighted(Approved) column