Tricky Sum question

tommacca

New Member
Joined
Aug 6, 2014
Messages
41
Hi Guys

I have a the table below which I am trying to work backwards to remove a leave balance essentially I want to deduct LSL hours (45) from the hours column working backwards so once 0 is reached in moves to the next row and deducts from that, in this case we would still be at +5 because the LSL hours taken are 45 and the balance is 50 but in the cicumstance where LSL taken was 60 then it would need to minus the 50 display 0 then move to detract the remaining amout from the following row. Is that possible?








LSL Taken
45.00
Total Days Between Start and End
8674
Range
Days
Percentage
Hours
Pre 16/08/78
0.00%
16/08/78 – 17/08/93
940
10.84%
5.4185
Post 17/08/93
7734
89.16%
44.5815
8674
100.00%
50.0000

<tbody>
</tbody>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Is this what you mean?

If not, please explain the full expected results and layout for the below example.

Formula in E7 copied down.

Excel Workbook
ABCDE
1LSL Taken45
2
3Total Days Between Start and End8674
4
5RangeDaysPercentageHoursBalance
6Pre 16/08/780.00%
716/08/78 17/08/9394010.84%5.41855.4185
8Post 17/08/93773489.16%44.581544.5815
98674100.00%505
Deduct Backwards
 
Upvote 0
Hi,

Sorry it would need to deduct b1 from d8, b1 was then larger than d8 it would need to remove the remaning amount from d7 then if b1 was larger than d8 and d7 it would remove the remaining from d6

I think that makes sense?

hope that helps?
Is this what you mean?

If not, please explain the full expected results and layout for the below example.

Formula in E7 copied down.

Deduct Backwards

*ABCDE
1LSL Taken45***
2*****
3Total Days Between Start and End8674***
4*****
5RangeDaysPercentageHoursBalance
6Pre 16/08/78*0.00%**
716/08/78 – 17/08/9394010.84%5.41855.4185
8Post 17/08/93773489.16%44.581544.5815
9*8674100.00%505

<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 223px;"><col style="width: 66px;"><col style="width: 94px;"><col style="width: 80px;"><col style="width: 68px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
E7=MAX(MIN(SUM(D7:D$9)-B$1,D7),0)

<tbody>
</tbody>

<tbody>
</tbody>




Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Hi,

Sorry it would need to deduct b1 from d8, b1 was then larger than d8 it would need to remove the remaning amount from d7 then if b1 was larger than d8 and d7 it would remove the remaining from d6
You refer to D8, D7 and D6. Your data does not show rows or columns so I assume you are referring to my screen shot. However I did not have data in D6 so I can only assume you mean D9, D8 and D7 in my previous screen shot.

If that is so, I thought my formula is doing what you want.

Here is my sheet again, adjusted the rows to match your description better but with a different value in B1.

Excel Workbook
ABCDE
1LSL Taken95
2
3Total Days Between Start and End8674
4RangeDaysPercentageHoursBalance
5Pre 16/08/780.00%
616/08/78 17/08/9394010.84%5.41855
7Post 17/08/93773489.16%44.58150
88674100.00%500
Deduct Backwards





b1 was then larger than d8
It is, so per your first post ".. in the cicumstance where LSL taken was 60 then it would need to minus the 50 display 0 then move .." my formula displays 0 in E8.


it would need to remove the remaning amount from d7
Remaining amount is larger than D7, so my formula displays 0 in E7.


b1 was larger than d8 and d7 it would remove the remaining from d6
It is. The amount removed from the bottom 2 rows was 50+44.5815 = 94.5815. The amount remaining from 95 is 95 - 94.5815 = 0.4185. So remove that amount from D5. 5.4185 - 0.4185 = 5 as displayed in E6.


Are they the numbers you want as your results?

If they are the right numbers but you want them actually in cells D6:D9 rather than beside in column E, then you would need a macro to do that. Is that what you want?

If the numbers are wrong, as I asked before ...
please explain the full expected results and layout
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

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