FiFo Inventory

vhanhto

New Member
Joined
Jul 9, 2013
Messages
2
Hello,

I'm working on a problem and needing some help with a macro that will do FiFo. Example on 7/9/2013, the projected prod unit is 2241, what I need to do is applying the FiFo method by using the earliest inventory first so I will use 6/24, 6/25, 6/26, 6/27, 7/2, 7/3 and part of 07/8 inventory. So for the Oldest Cart date column, I need 7/9/13 row to show 07/08/13. How do I do this. I know very little about VBA and having a hard time following all the threads. Any help will be greatly appreciated.

Many Thanks,

DateinventoryProjected ProdOldest Cart Date
6/24/13100
6/25/13200
6/26/13300
6/27/13290
6/28/13
6/29/13
6/30/13
7/1/13
7/2/13400
7/3/13625
7/4/13
7/5/13
7/6/13
7/7/13
7/8/132601
7/9/1317632241
7/10/1317632241
7/11/1317632241
7/12/1317632241
7/13/1300
7/14/1300
7/15/1318022244
7/16/1318012241
7/17/1318012241
7/18/1318012241
7/19/1318012241

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Code:
Sub FiFo()
    Dim rgProjected As Range
    Dim rgInventory As Range
    Dim iInvenTotal As Long
    With Sheets("Sheet2") 'change Sheet name as needed
        Set rgProjected = .Cells(1, 3).End(xlDown)
        Set rgInventory = .Cells(2, 2)
    End With
    iInvenTotal = iInvenTotal + rgInventory
    Do Until iInvenTotal >= rgProjected
        Set rgInventory = rgInventory.Offset(1)
        iInvenTotal = iInvenTotal + rgInventory
    Loop
    rgProjected.Offset(, 1) = rgInventory.Offset(, -1)
End Sub
 
Upvote 0
warship, Thank you so much for your code. It's working. How do I get it to go through the rest of the list? So on 07/10/13 (column A), we will use the left over inventory for 07/08/13 and then inventory for 07/09/13. So for that day the Oldest Cart date would be 07/09/13 and so forth down the list.

Many thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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