Complex Formula Value Distribute

aqeelnokia99

Board Regular
Joined
Dec 23, 2018
Messages
145
Office Version
  1. 2013
Platform
  1. Windows
Hi Experts i try to Distribute Value from Table 1 Until its Reached Value 1000000 if its Reached Write Remaining amount and start from again from Remain amount for Example
if you see Result from Value 1130 to 465001 Total is 979026 to Reach @ 1000000 we need more 1000000-979026 =20974 This amount will come from Table 1 SR # 5 Which is 250000 After That is you see Result Table next value is 229026 which = to 250000-20974 so on in Simple Distribute Value of table 1 Value Until its Reached 1000000 if its Possible with formula or Vba will Very Big Thanks

Table 11000000
SR#EurosResult
111301130
2171361171361
3341534341534
4465001465001
525000020974This Part is Remaing Balance to Reach amount 1000000
6390854229026Start from again from 250000-20974
7307572390854
8710127307572
960000072548
10260208637579
11500000362421
12274438
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try the following :

Cell Formulas
RangeFormula
G3:G31G3=IF(G2>$D$1,B3,G2+B3)
H3H3=IF(G3>$D$1,IF($D$1*COUNTIF($G$3:G3,">"&$D$1)-SUM($D2:D$3)=0,B3,$D$1*COUNTIF($G$3:G3,">"&$D$1)-SUM($D2:D$3)),B3)
I3:I31I3=IF($D$1*COUNTIF($G$3:G3,">"&$D$1)-SUM($H$3:H3)=0,B3-H3,"")
J3:J31J3=IFERROR(INDEX(Data,1+INT((ROW(A1)-1)/COLUMNS(Data)),MOD(ROW(A1)-1+COLUMNS(Data),COLUMNS(Data))+1),"")
H4:H31H4=IF(G4>$D$1,IF($D$1*COUNTIF($G$3:G4,">"&$D$1)-SUM($H$3:H3)=0,B4,$D$1*COUNTIF($G$3:G4,">"&$D$1)-SUM($H$3:H3)),B4)
D3:D17D3=IFERROR(INDEX(J:J,SMALL(IF(J$3:J$1000<>"",ROW(J$3:J$1000)), ROWS(J$3:J3))), "")
 
Upvote 0
i found 1 issue after result 307572 Row #10 Next Result must 72548 because to Reach on 1000000 we need more 72548
10000001130
171361
341534
465001
20974
1000000229026
390854
307572
72548
1000000637579
362421
 
Upvote 0
Try the updated version :

Cell Formulas
RangeFormula
G3:G7G3=IF(G2>$D$1,B3,G2+B3)
H3H3=IF(G3>$D$1,IF($D$1*COUNTIF($G$3:G3,">"&$D$1)-SUM($H2:I$3)=0,B3,$D$1*COUNTIF($G$3:G3,">"&$D$1)-SUM($H2:I$3)),B3)
I3I3=IF($D$1*COUNTIF($G$3:G3,">"&$D$1)-SUM($H$3:H3)=0,B3-H3,"")
J3:J31J3=IFERROR(INDEX(Data,1+INT((ROW(A1)-1)/COLUMNS(Data)),MOD(ROW(A1)-1+COLUMNS(Data),COLUMNS(Data))+1),"")
H4:H31H4=IF(G4>$D$1,IF($D$1*COUNTIF($G$3:G4,">"&$D$1)-SUM($H$3:I3)=0,B4,$D$1*COUNTIF($G$3:G4,">"&$D$1)-SUM($H$3:I3)),B4)
I4:I31I4=IF($D$1*COUNTIF($G$3:G4,">"&$D$1)-SUM($H$3:H4)-SUM($I$3:I3)=0,B4-H4,"")
G8:G31G8=IF(G7>$D$1,B8+I7,G7+B8)
D3:D20D3=IFERROR(INDEX(J:J,SMALL(IF(J$3:J$1000<>"",ROW(J$3:J$1000)), ROWS(J$3:J3))), "")


Data refers to Named range = $H$3:$I$31
 
Upvote 0
i change Value its give negative Result for some reason
Apr-231000000
SR#DateEurosExchange RateBalance EurosResultHelper1Helper2Helper3Helper4
108-Nov-22200000224200000Apr-23200000200000200000
231-Jan-23171361288171361Apr-23371361171361
331-Jan-23341534288341534Apr-23712895341534171361
409-Feb-23465001290.111287105Apr-231177896287105177896
513-Feb-23250000280€ 229,026177896May-23250000250000341534
613-Feb-23390854288250000May-23640854390854
721-Feb-23307572279390854May-23948426307572287105
827-Feb-23710127274€ 637,579307572May-231658553-126322836449177896
909-Mar-23600000297.7€ 237,5791-126322May-231436449163551436449250000
1013-Mar-23260208302.2836449Jun-23696657260208
1121-Mar-235000003021163551Jun-231196657303343196657390854
1228-Mar-23274438304.81€ 272,225436449Jul-23471095274438
260208Jul-234710950307572
1303343Jul-234710950
196657Aug-234710950-126322
274438Aug-234710950836449
0Aug-234710950163551
0Aug-234710950436449
0Aug-234710950260208
#NUM!#NUM!#NUM!4710950
#NUM!#NUM!#NUM!4710950303343
#NUM!#NUM!#NUM!4710950196657
4710950274438
4710950
47109500
4710950
47109500
4710950
47109500
 
Upvote 0
Hopefully now you should not have any problem :

Book2
ABCDEFGHIJKLM
101/04/20231,000,000
2SR#DateEurosExchange RateBalance EurosResultHelper1Helper2Helper3Helper4
3108/11/2022200,000223.94 200,000Apr-23200,000200,000 200,000
4231/01/2023171,361288.29 171,361Apr-23371,361171,361
5331/01/2023341,534288.29 341,534Apr-23712,895341,534 171,361
6409/02/2023465,001290.11€ 177,896287,105Apr-231,177,896287,105177,896
7513/02/2023250,000279.98 177,896May-23427,896250,000 341,534
8613/02/2023390,854288.36 250,000May-23818,750390,854
9721/02/2023307,572279.43€ 126,322390,854May-231,126,322181,250126,322287,105
10827/02/2023710,127274.01 181,250May-23836,449710,127 177,896
11909/03/2023600,000297.7€ 436,449126,322May-231,436,449163,551436,449250,000
121013/03/2023260,208302.2 710,127Jun-23696,657260,208
131121/03/2023500,000302€ 196,657163,551Jun-231,196,657303,343196,657390,854
141228/03/2023274,438304.81 436,449Jul-23471,095274,438
15260,208Jul-23471,095- 181,250
16303,343Jul-23471,095- 126,322
17196,657Aug-23471,095- 710,127
18274,438Aug-23471,095-
19-Aug-23471,095- 163,551
20-Aug-23471,095- 436,449
21-Aug-23471,095- 260,208
22 471,095-
23 471,095- 303,343
24 471,095- 196,657
25471,095- 274,438
26471,095-
27471,095- -
28471,095-
29471,095- -
30471,095-
31471,095- -
Sheet1
Cell Formulas
RangeFormula
J3J3=IF(J2>$G$1,C3,J2+C3)
K3K3=IF(J3>$G$1,IF($G$1*COUNTIF($J$3:J3,">"&$G$1)-SUM($K2:L$3)=0,C3,$G$1*COUNTIF($J$3:J3,">"&$G$1)-SUM($K2:L$3)),C3)
L3L3=IF($G$1*COUNTIF($J$3:J3,">"&$G$1)-SUM($K$3:K3)=0,C3-K3,"")
M3:M31M3=IFERROR(INDEX($K$3:$L$31,1+INT((ROW(A1)-1)/2),MOD(ROW(A1)-1+2,2)+1),"")
J4:J31J4=IF(J3>$G$1,C4+L3,J3+C4)
K4:K31K4=IF(J4>$G$1,IF($G$1*COUNTIF($J$3:J4,">"&$G$1)-SUM($K$3:L3)=0,C4,$G$1*COUNTIF($J$3:J4,">"&$G$1)-SUM($K$3:L3)),C4)
L4:L31L4=IF($G$1*COUNTIF($J$3:J4,">"&$G$1)-SUM($K$3:K4)-SUM($L$3:L3)=0,C4-K4,"")
E3:E14E3=L3
G3:G24G3=IFERROR(INDEX(M:M,SMALL(IF(M$3:M$1000<>"",ROW(M$3:M$1000)), ROWS(M$3:M3))), "")
 
Upvote 0

Forum statistics

Threads
1,216,104
Messages
6,128,856
Members
449,472
Latest member
ebc9

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