Capacity Constraints and Scheduling...

auballard

New Member
Joined
Mar 17, 2009
Messages
15
I have a list of parts that has x amount of minutes to produce. I have a limited capacity each week. I would like to create an easy way to create a "matrix" that shows how the production minutes can be distributed. I need to be able to change the capacity as necessary.

[TABLE="width: 623"]
<colgroup><col><col><col><col span="4"></colgroup><tbody>[TR]
[TD]Part[/TD]
[TD]Total Minutes[/TD]
[TD]WK1[/TD]
[TD]WK2[/TD]
[TD]WK3[/TD]
[TD]WK4[/TD]
[TD]WK5[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]280[/TD]
[TD]280[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2079[/TD]
[TD]1640[/TD]
[TD]439[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]4200[/TD]
[TD][/TD]
[TD]1481[/TD]
[TD]1920[/TD]
[TD]799[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2552[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1121[/TD]
[TD]1431[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]396[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]396[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]7134[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]93[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]1476[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]2288[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Capacity[/TD]
[TD]1920[/TD]
[TD]1920[/TD]
[TD]1920[/TD]
[TD]1920[/TD]
[TD]1920[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try this:-
NB:- This code should cover all column "WKs" that are applicable (i.e. WK columns in sheet)
Code:
[COLOR="Navy"]Sub[/COLOR] MG08Nov08
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] hSum [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] vSum1 [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] vSum2 [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
Lst = Cells("1", Columns.Count).End(xlToLeft).Column
[COLOR="Navy"]Set[/COLOR] Rng = Range("B2", Range("B" & Rows.Count).End(xlUp))

[COLOR="Navy"]For[/COLOR] ac = 1 To Lst
   [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
     [COLOR="Navy"]If[/COLOR] Not Dn.Address = Rng(Rng.Count).Address [COLOR="Navy"]Then[/COLOR]
        vSum1 = Abs(Application.Sum(Rng.Resize(Rng.Count - 1).Offset(, ac)))
        vSum2 = Abs(Rng(Rng.Count).Offset(, ac))
        hSum = Abs(Application.Sum(Dn.Offset(, 1).Resize(, Lst)))
        
        [COLOR="Navy"]If[/COLOR] Not vSum1 = vSum2 And Not hSum = Dn.Value [COLOR="Navy"]Then[/COLOR]
            [COLOR="Navy"]If[/COLOR] (Dn.Value - hSum) < (vSum2 - vSum1) [COLOR="Navy"]Then[/COLOR]
                Dn.Offset(, ac).Value = Dn.Value - hSum
            [COLOR="Navy"]Else[/COLOR]
                Dn.Offset(, ac).Value = vSum2 - vSum1
            [COLOR="Navy"]End[/COLOR] If
        
        [COLOR="Navy"]End[/COLOR] If
    [COLOR="Navy"]End[/COLOR] If
  [COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]Next[/COLOR] ac
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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