Hi all,
Per below example, how can I design a macro that when clicked, will calculate the values in Column D, such that the current percentage reaches 50%.
In below example, to achieve 50%, the sum in Column B should be 15/30, meaning I am lacking 6 hours (from the existing 9 hours). The macro should thus run, and calculate that these 6 hours should be allocated to the Person A. Note that the maximum hours allocated is subject to the maximum of the value in Column C. If the limit is reached (e.g. 8 for Person A), it should go on to the next row to determine how much additional to hit the current percentage of 50%
--------------------------
Current Percentage: 30% [ (sum of Row A + Row D) / sum of Row D]
[TABLE="width: 100%"]
<tbody>[TR]
[TD]
[/TD]
[TD](A)
[/TD]
[TD](B)
[/TD]
[TD](C)
[/TD]
[TD](D)
[/TD]
[/TR]
[TR]
[TD]Name
[/TD]
[TD]Actual Hours
[/TD]
[TD]Maximum Hours
[/TD]
[TD]Differential (B) – (A)
[/TD]
[TD]Calculation Logic
[/TD]
[/TR]
[TR]
[TD]Person A
[/TD]
[TD]2
[/TD]
[TD]10
[/TD]
[TD]8
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Person B
[/TD]
[TD]3
[/TD]
[TD]10
[/TD]
[TD]7
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Person C
[/TD]
[TD]4
[/TD]
[TD]10
[/TD]
[TD]6
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Total
[/TD]
[TD]9
[/TD]
[TD]30
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]9/30 = 30%
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]
Per below example, how can I design a macro that when clicked, will calculate the values in Column D, such that the current percentage reaches 50%.
In below example, to achieve 50%, the sum in Column B should be 15/30, meaning I am lacking 6 hours (from the existing 9 hours). The macro should thus run, and calculate that these 6 hours should be allocated to the Person A. Note that the maximum hours allocated is subject to the maximum of the value in Column C. If the limit is reached (e.g. 8 for Person A), it should go on to the next row to determine how much additional to hit the current percentage of 50%
--------------------------
Current Percentage: 30% [ (sum of Row A + Row D) / sum of Row D]
[TABLE="width: 100%"]
<tbody>[TR]
[TD]
[/TD]
[TD](A)
[/TD]
[TD](B)
[/TD]
[TD](C)
[/TD]
[TD](D)
[/TD]
[/TR]
[TR]
[TD]Name
[/TD]
[TD]Actual Hours
[/TD]
[TD]Maximum Hours
[/TD]
[TD]Differential (B) – (A)
[/TD]
[TD]Calculation Logic
[/TD]
[/TR]
[TR]
[TD]Person A
[/TD]
[TD]2
[/TD]
[TD]10
[/TD]
[TD]8
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Person B
[/TD]
[TD]3
[/TD]
[TD]10
[/TD]
[TD]7
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Person C
[/TD]
[TD]4
[/TD]
[TD]10
[/TD]
[TD]6
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]Total
[/TD]
[TD]9
[/TD]
[TD]30
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]9/30 = 30%
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]