Need Help!: Subtract number from cell until it reaches 0, then subtract remainder from different cell

Eggplant2016

New Member
Joined
Jan 20, 2019
Messages
14
Need Help!! I can't for the life of me figure out how to do this.
I am looking for a formula that will allow me to do this:

Cell O46 tracks the current Hit point points of a character. The max HP is found in cell G46, which is used to calculate the current HP by suming all the damage done in a round which has been input into cells G49:S49.

So if max HP is 150, and the sum of cells G49:S49 are 75, then the current HP in cell O46 is 75.

Cell W46 tracks the total temporary hit points. Which contains a generated number.

If there is an amount of temporary hitpoints in cell W46 that is greater than 0, I want any damage that is put into cells G49:S49 to first subtract from the temporary hitpoints in cell W46 until it reaches 0, and then apply the remainder to be subtracted from current hitpoints in cell O46.

Is this possible??
Thanks in advance.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi there,

If I've understood your request (big if here), try this formula in cell O46:

=IF(W46>0,G46-(SUM(G49:S49)-W46),G46-(SUM(G49:S49)))

Regards,

Robert
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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