Formula(s) or VBA to re-distribute PTO hour balance

bh24524

Active Member
Joined
Dec 11, 2008
Messages
365
Office Version
  1. 365
  2. 2007
Hi, I'm looking for a way to more automate a distribution of a balance of PTO hours across a designated number of weeks. The total hours someone is entitled to per week populates via formula in F29. H29 has a listing of how many total weeks they are entitled to, K29 adds a flat 8 hours onto the overall total(this actually gets added to their first week only. Finally M29 gives a grand total of all weeks. This is pictured below:
1718717209437.png


What I want to do is in column P starting in row 19 is list the weeks and have balances automatically populate to them. In a simple scenario, that would look like this:

1718717523140.png

When you total up all of these weeks, they should equal 168.0 (M29). Notice that the first week is higher than the others - it would have 8 hours from K29 added to it. Only the first week gets this, so that week will always be 8 hours higher than teh rest. The rest would be distributed among the remaining 5 weeks so that their combined total equals M29.

Here is what complicates the process further. The person can opt to designate 1 to 2 weeks as what is called "Split" weeks (S). If someone elects to do that, then a flat 40 hours is reserved for that week and then the calculation is redistributed across the remaining weeks. If that were the case in the above scenario, it would look like this:
1718718662431.png

So in this case because column Q has "S" next to a week, that should automatically allocate 40 hours to that week's value and the rest of the weeks should recalculate, dispersing the remaining value across the rest of the weeks and of course adding the 8 hours to the first week, all so that it totals M29. There could be instances where a person is not entitled to 6 weeks, it could be less, so that is another consideration.

Is something like this even doable with VBA?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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