subtract remaining number from different cell and 'remember' it

Marc Mostert

New Member
Joined
Nov 19, 2018
Messages
1
Hello guys,

Trying to subtract a number from a cell until it reaches 0, then subtract the remaining from a different cell and keep that number for the next time.

A1 has a value of 50, that is the spare amount
A2 has a value of 30, that is the total amount
then in B2 I have a value of 10
b3 a value of 10
b4 a value of 11

then B5 should say 0 and not -1 (the total of 30-10-10-11) and B6 should say 40 (the spare-1)

C2 has a value of 10
c3 has a value of 1
c4 has a value of 4

then C5 should say 49 (because the spare is not used this time)

D2 has a value of 10
D3 has a value of 15
D4 has a value of 15

Then D5 should have a of 39 (the spare is used again because it sums up to 40 which is 10 more then the total amount, but it should subtract form 49.)

I hope someone can help me set this up and I hope you understand what i mean, it's much clearer in my head ;P

Regards, Marc
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Welcome to the Forum

Like this?

B5: =MAX(0,$A2-SUM(B2:B4)) copy across
B6: =MAX(0,$A1+MIN(0,$A2-SUM(B2:B4)))
C6: =MAX(0,B6+MIN(0,$A2-SUM(C2:C4))) copy across


Book1
ABCDE
150
23010101025
31011525
41141525
501500
64949390
Sheet1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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