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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,215,487
Messages
6,125,082
Members
449,205
Latest member
Healthydogs

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