subtract from multiple cells until reach 0

fastballfreddy

Board Regular
Joined
Jan 13, 2015
Messages
60
Office Version
  1. 2016
Platform
  1. Windows
I'm currently using an if function but want to see if there is an easier formula. I have 7 cells (1-7 columns) and want determine after subtracting Payment (starting from 7 and going to 1) what # how much is left.

For example the first one has payment of 75. Starting from 7 and working down to 1 subtracting would leave 30 left in #6

Below are the 2 formulas I'm currently using which works but reaching out to see if there is a simpler formula that can be use for situations like this. Thanks in advance!

formula for amount left: =ABS(IF(H8-G8<0,H8-G8,IF(H8-SUM(F8:G8)<0,H8-SUM(F8:G8),IF(H8-SUM(E8:G8)<0,H8-SUM(E8:G8),IF(H8-SUM(D8:G8)<0,H8-SUM(D8:G8),IF(H8-SUM(C8:G8)<0,H8-SUM(C8:G8),IF(H8-SUM(B8:G8)<0,H8-SUM(B8:G8),IF(H8-SUM(A8:G8)<0,H8-SUM(A8:G8)))))))))

formula for #: =IF(H8-G8<0,7,IF(H8-SUM(F8:G8)<0,6,IF(H8-SUM(E8:G8)<0,5,IF(H8-SUM(D8:G8)<0,4,IF(H8-SUM(C8:G8)<0,3,IF(H8-SUM(B8:G8)<0,2,IF(H8-SUM(A8:G8)<0,1)))))))
1​
2​
3​
4​
5​
6​
7​
Payment​
Amount Left​
#​
100
100
90
80
80
80
25
75
30
6
100​
100​
100​
100​
25​
0​
0​
325​
100​
1​
75​
75​
75​
75​
75​
50​
35​
250​
60​
3​
100​
100​
100​
100​
90​
80​
45​
100​
25​
6​
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Formula for balance in top row, if your table starts in A1
= SUM(OFFSET[H2,0,J2-8,1,8-H2))-H2
copy down
 
Upvote 0
to see if there is a simpler formula that can be use for situations like this.
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version.

Here is one possible way.

20 03 13.xlsm
ABCDEFGHIJ
71234567PaymentAmount Left#
8100100908080802575306
910010010010025003251001
1075757575755035250603
11100100100100908045100256
Amount Left
Cell Formulas
RangeFormula
I8:I11I8=SUM(INDEX(A8:G8,J8):G8)-H8
J8:J11J8=IFERROR(AGGREGATE(14,6,A$7:G$7/((SUM(A8:G8)-SUMIF(A$7:G$7,"<="&A$7:G$7,A8:G8))>H8),1)+1,1)
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
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