Change to positive /negative where applicable to arrive at final total

sleek12

Board Regular
Joined
May 3, 2014
Messages
72
Office Version
  1. 365
Platform
  1. Windows
cross-posted from another forum:-

Change to positive /negative where applicable to arrive at final total


I managed to get all reconciliation items, but whether its negative/positive aspect sometimes is confusing or elusive.
This is the PROBLEM:- (I was trying to use SOLVER add-in here), however any solution with PQ, Macro is well as I use office 365.

Tenant (Debtor) Transactions1.xlsx
ABCDEFGHIJK
1Kshscurrency
2Balance as per tenant 2,597,184.10
3Add: invoices not posted by us01/11/2021b901Deposit ChargeDeposit charge4,715,615.760.004,715,615.7614,715,615.76
401/11/2021b776Other Recoverable ExpenseReletting fees for tenant348,000.000.00348,000.001348,000.00
501/11/2021b776Other Recoverable ExpenseLegal fees for tenant74,600.000.0074,600.00174,600.00
601/12/2021i011RentFor period 15/12/2021 to 14/03/20221,578,000.00252,480.001,830,480.0011,830,480.00
701/12/2021i014Parking RentFor period 15/12/2021 to 14/03/2022231,000.0036,960.00267,960.001267,960.00
801/03/2022i011RentFor period 15/03/2022 to 14/06/20221,578,000.00252,480.001,830,480.0011,830,480.00
901/03/2022i014Parking RentFor period 15/03/2022 to 14/06/2022231,000.0036,960.00267,960.001267,960.00
10Add: payments made by ourselves not reflected in landlord01/07/20213487375,000.001375,000.00
11chq 3850 posted as 375500 instead of 375000500.001500.00
12less: payments made by ourselves not updated in ERP26/10/20211824401,542.851401,542.85
13less: deposit refund not posted in ERP25/11/20219,358,656.0019,358,656.00
14less credit note refund not posted by ourselves15/03/202246,766.00146,766.00
15Add: invoice posted in ERP not reflected in landlord, why ???2,075,878.9212,075,878.92
16opening bal adjustmentMO4,527,542.0114,527,542.01
17tenant2,923,365.1812,923,365.18
18Balance as per landlord31,641,530.822,029,112.92
Problemdefined
Cell Formulas
RangeFormula
I3:I17I3=K3*J3
I18I18=SUM(I2:I17)
J18J18=solutionrequired!I20
Named Ranges
NameRefers ToCells
solver_adj=Problemdefined!$J$3:$J$17I3
solver_lhs1=Problemdefined!$J$8I8
solver_lhs10=Problemdefined!$J$17I17
solver_lhs11=Problemdefined!$J$3I3
solver_lhs12=Problemdefined!$J$4I4
solver_lhs13=Problemdefined!$J$5I5
solver_lhs14=Problemdefined!$J$6I6
solver_lhs15=Problemdefined!$J$7I7
solver_lhs2=Problemdefined!$J$9I9
solver_lhs3=Problemdefined!$J$10I10
solver_lhs4=Problemdefined!$J$11I11
solver_lhs5=Problemdefined!$J$12I12
solver_lhs6=Problemdefined!$J$13I13
solver_lhs7=Problemdefined!$J$14I14
solver_lhs8=Problemdefined!$J$15I15
solver_lhs9=Problemdefined!$J$16I16


Herewith is the SOLUTION:- what i wanted was is there any way i can turn some of the numbers into negative to total to 2,029,112.92 so my reconciliation can agree:-

Tenant (Debtor) Transactions1.xlsx
ABCDEFGHI
1Kshscurrency
2Balance as per tenant 2,597,184.10
3Add: invoices not posted by
4ourselves
501/11/2021b901Deposit ChargeDeposit charge4,715,615.760.004,715,615.76
601/11/2021b776Other Recoverable ExpenseReletting fees for tenant348,000.000.00348,000.00
701/11/2021b776Other Recoverable ExpenseLegal fees for tenant74,600.000.0074,600.00
801/12/2021i011RentFor period 15/12/2021 to 14/03/20221,578,000.00252,480.001,830,480.00
901/12/2021i014Parking RentFor period 15/12/2021 to 14/03/2022231,000.0036,960.00267,960.00
1001/03/2022i011RentFor period 15/03/2022 to 14/06/20221,578,000.00252,480.001,830,480.00
1101/03/2022i014Parking RentFor period 15/03/2022 to 14/06/2022231,000.0036,960.00267,960.00
12Add: payments made by ourselves not reflected in landlord01/07/20213487375,000.00
13chq 3850 posted as 375500 instead of 375000500.00
14less: payments made by ourselves not updated in ERP26/10/20211824-401,542.85
15less: deposit refund not posted in ERP25/11/2021-9,358,656.00
16less credit note refund not posted by ourselves15/03/2022-46,766.00
17Add: invoice posted in ERP not reflected in landlord, why ???-2,075,878.92
18opening bal adjustmentMO4,527,542.01
19tenant-2,923,365.18
20Balance as per landlord2,029,112.92
solutionrequired
Cell Formulas
RangeFormula
I20I20=SUM(I2:I19)
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I'm not sure that I have what you are looking for, and there was not a solution for the numbers you have - as I understood them. But here is what I prepared.

I've got it spread out to make it understandable, but it could be boiled down to one or two actual formulas without all the intermediate steps.

MrExcelPlayground7.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
1$4,715,615.76$4,715,615.760-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1027934-11111-1-1-11-111-111
2$348,000.00$348,000.0011-1-1-1-1-1-1-1-1-1-1-1-1-1-1027958-111-111-1-11-111-111
3$74,600.00$74,600.002-11-1-1-1-1-1-1-1-1-1-1-1-1-1027982-1111-1-11-11-111-111
4$1,830,480.00$1,830,480.00311-1-1-1-1-1-1-1-1-1-1-1-1-1028006-111-1-111-11-111-111
5$267,960.00$267,960.004-1-11-1-1-1-1-1-1-1-1-1-1-1-10
6$1,830,480.00$1,830,480.0051-11-1-1-1-1-1-1-1-1-1-1-1-10
7$267,960.00$267,960.006-111-1-1-1-1-1-1-1-1-1-1-1-10
8$375,000.00$375,000.007111-1-1-1-1-1-1-1-1-1-1-1-10
9$500.00$500.008-1-1-11-1-1-1-1-1-1-1-1-1-1-10
10-$401,542.85$401,542.8591-1-11-1-1-1-1-1-1-1-1-1-1-10
11-$9,358,656.00$9,358,656.0010-11-11-1-1-1-1-1-1-1-1-1-1-10
12-$46,766.00$46,766.001111-11-1-1-1-1-1-1-1-1-1-1-10
13-$2,075,878.92$2,075,878.9212-1-111-1-1-1-1-1-1-1-1-1-1-10
14$4,527,542.01$4,527,542.01131-111-1-1-1-1-1-1-1-1-1-1-10
15-$2,923,365.18$2,923,365.1814-1111-1-1-1-1-1-1-1-1-1-1-10
16151111-1-1-1-1-1-1-1-1-1-1-10
1716-1-1-1-11-1-1-1-1-1-1-1-1-1-10
18$9,711,391.66171-1-1-11-1-1-1-1-1-1-1-1-1-10
1918-11-1-11-1-1-1-1-1-1-1-1-1-10
202029112.921911-1-11-1-1-1-1-1-1-1-1-1-10
Sheet21
Cell Formulas
RangeFormula
C1:C15C1=ABS(A1:A15)
D1:D32768D1=SEQUENCE(2^15)-1
E1:S32768,W1:AK4E1=SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(15,1,0,1))),D1#)-0.5)
U1:U32768U1=(--(MMULT(E1#,C1#)=C18))*D1#
V1:V4V1=FILTER(U1#,U1#<>0)
Dynamic array formulas.
 
Upvote 0
No, @JamesCanale actually you're supposed to start with absolute values, then from thereon you determine which amounts can be made negative to arrive at final total. (its like Goal seek but with multiple amounts)
Start with opening balance:-
2597184.1
then from the list of absolute values , determine which of the set to make negative so as to reach 2,029,112.92.
These was the solution see below:- the ones that became RED (negative), the trick is there a macro or PQ or formula to change absolute to negative so i arrive at my predetermined total 2,029,112.92

Tenant (Debtor) Transactions1.xlsx
I
54,715,615.76
6348,000.00
774,600.00
81,830,480.00
9267,960.00
101,830,480.00
11267,960.00
12375,000.00
13500.00
14-401,542.85
15-9,358,656.00
16-46,766.00
17-2,075,878.92
184,527,542.01
19-2,923,365.18
solutionrequired
 
Upvote 0
I think that I have what you want. I don't do a goal seek - I have excel do every possible combination of +/- for 15 numbers. I just don't get this set to add up to the number you are looking for.

The way you have it shown here it doesn't add up to 2.5M, it's -568,071.18.
 
Upvote 0
I think that I have what you want. I don't do a goal seek - I have excel do every possible combination of +/- for 15 numbers. I just don't get this set to add up to the number you are looking for.

The way you have it shown here it doesn't add up to 2.5M, it's -568,071.18.
But I informed you of opening balance of 2597184.1 in my thread @JamesCanale add that to _568071.18
 
Upvote 0
I see now - and there is the one solution that you had. So here it is with my calculations:

MrExcelPlayground7.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
1$4,715,615.761$4,715,615.760-1-1-1-1-1-1-1-1-1-1-1-1-1-1-108703111111111-1-1-1-11-1
2$348,000.001$348,000.0011-1-1-1-1-1-1-1-1-1-1-1-1-1-10
3$74,600.001$74,600.002-11-1-1-1-1-1-1-1-1-1-1-1-1-10
4$1,830,480.001$1,830,480.00311-1-1-1-1-1-1-1-1-1-1-1-1-10
5$267,960.001$267,960.004-1-11-1-1-1-1-1-1-1-1-1-1-1-10
6$1,830,480.001$1,830,480.0051-11-1-1-1-1-1-1-1-1-1-1-1-10
7$267,960.001$267,960.006-111-1-1-1-1-1-1-1-1-1-1-1-10
8$375,000.001$375,000.007111-1-1-1-1-1-1-1-1-1-1-1-10
9$500.001$500.008-1-1-11-1-1-1-1-1-1-1-1-1-1-10
10-$401,542.85-1$401,542.8591-1-11-1-1-1-1-1-1-1-1-1-1-10
11-$9,358,656.00-1$9,358,656.0010-11-11-1-1-1-1-1-1-1-1-1-1-10
12-$46,766.00-1$46,766.001111-11-1-1-1-1-1-1-1-1-1-1-10
13-$2,075,878.92-1$2,075,878.9212-1-111-1-1-1-1-1-1-1-1-1-1-10
14$4,527,542.011$4,527,542.01131-111-1-1-1-1-1-1-1-1-1-1-10
15-$2,923,365.18-1$2,923,365.1814-1111-1-1-1-1-1-1-1-1-1-1-10
16151111-1-1-1-1-1-1-1-1-1-1-10
1716-1-1-1-11-1-1-1-1-1-1-1-1-1-10
18-568071.18171-1-1-11-1-1-1-1-1-1-1-1-1-10
Sheet21
Cell Formulas
RangeFormula
B1:B15B1=TRANSPOSE(W1#)
C1:C15C1=ABS(A1:A15)
D1:D32768D1=SEQUENCE(2^15)-1
E1:S32768,W1:AK1E1=SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(15,1,0,1))),D1#)-0.5)
U1:U32768U1=(--(MMULT(E1#,C1#)=C18))*D1#
V1V1=FILTER(U1#,U1#<>0)
C18C18=2029112.92-2597184.1
Dynamic array formulas.


Or boiled down:

MrExcelPlayground7.xlsx
ABCD
1CoefficientsValues
2Start$2,597,184.101$4,715,615.76
3Finish$2,029,112.921$348,000.00
4Change-$568,071.181$74,600.00
51$1,830,480.00
61$267,960.00
71$1,830,480.00
81$267,960.00
91$375,000.00
101$500.00
11-1$401,542.85
12-1$9,358,656.00
13-1$46,766.00
14-1$2,075,878.92
151$4,527,542.01
16-1$2,923,365.18
Sheet21 (2)
Cell Formulas
RangeFormula
C2:C16C2=TRANSPOSE(SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(ROWS(D2:D16),1,0,1))),FILTER((--(MMULT(SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(ROWS(D2:D16),1,0,1))),(SEQUENCE(2^ROWS(D2:D16))-1))-0.5),(D2:D16))=B4))*(SEQUENCE(2^ROWS(D2:D16))-1),(--(MMULT(SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(ROWS(D2:D16),1,0,1))),(SEQUENCE(2^ROWS(D2:D16))-1))-0.5),(D2:D16))=B4))*(SEQUENCE(2^ROWS(D2:D16))-1)<>0))-0.5))
B4B4=B3-B2
Dynamic array formulas.
 
Upvote 0
Solution
Thanks, it works perfectly @JamesCanale , I can discern what you did , First you changed everything to absolute. Then =SEQUENCE(2^15)-1 and =SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(15,1,0,1))),D2#)-0.5)to find out no. of combinations of 1 and -1, ==(--(MMULT(E1#,C1#)=C18))*D1# for difference in cell c18,The row in which the optimum combination is found =FILTER(U1#,U1#<>0), and of course to place it in columnar form =SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(15,1,0,1))),V1#)-0.5) and =TRANSPOSE(W1#) were the steps.
However when i used the same in a different scenario , i got #VALUE error

STETATEMENT JULY.xlsx
EF
2Start794,345.52
3-100,000.00
4-100,000.00
5-100,000.00
6479,213.54
7-100,000.00
8-100,000.00
9-200,000.00
10479,213.54
11-87,000.00
12-87,000.00
13-87,000.00
14-87,000.00
15-83,000.00
16-83,000.00
17-83,000.00
18-87,000.00
19-87,000.00
20-87,000.00
21479,213.54
22-87,000.00
23-87,000.00
24-20,772.00
25Finish479,214.14
Sheet1
Cell Formulas
RangeFormula
F25F25=SUM(F2:F24)


Wherein am i going wrong ? I've reviewed the formula several times ??

STETATEMENT JULY.xlsx
ABCD
2Start794,345.52#VALUE!100,000.00
3Finish479,214.14#VALUE!100,000.00
4Change-315,131.38#VALUE!100,000.00
5#VALUE!479,213.54
6#VALUE!100,000.00
7#VALUE!100,000.00
8#VALUE!200,000.00
9#VALUE!479,213.54
10#VALUE!87,000.00
11#VALUE!87,000.00
12#VALUE!87,000.00
13#VALUE!87,000.00
14#VALUE!83,000.00
15#VALUE!83,000.00
16#VALUE!83,000.00
17#VALUE!87,000.00
18#VALUE!87,000.00
19#VALUE!87,000.00
20#VALUE!479,213.54
21#VALUE!87,000.00
22#VALUE!87,000.00
23#VALUE!20,772.00
Sheet1
Cell Formulas
RangeFormula
C2:C23C2=TRANSPOSE(SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(ROWS(D2:D23),1,0,1))),FILTER((--(MMULT(SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(ROWS(D2:D23),1,0,1))),(SEQUENCE(2^ROWS(D2:D23))-1))-0.5),(D2:D23))=B4))*(SEQUENCE(2^ROWS(D2:D23))-1),(--(MMULT(SIGN(BITAND(TRANSPOSE(2^(SEQUENCE(ROWS(D2:D23),1,0,1))),(SEQUENCE(2^ROWS(D2:D23))-1))-0.5),(D2:D23))=B4))*(SEQUENCE(2^ROWS(D2:D23))-1)<>0))-0.5))
B4B4=B3-B2
Dynamic array formulas.
 
Upvote 0
I'm thinking that there was multiple solutions after the FILTER. You'r data looks like that would be certain. And the formula got itself into trouble and wouldn't pick just one correctly. I'll have to see about changing it to take the first row of the filter. Or maybe you would like to know when there are multiple solutions.
 
Upvote 0
Anyway, someone from the other forum provided me too with a solution:-
A bit more concise than yours , see below, so let me see how i fare:-

Tenant (Debtor) Transactions1.xlsx
ABCDEFGHIJK
1
2currencyn ►15
3
4Balance as per tenant Kshs2,597,184.102,597,184.10
5
6Add: invoices not posted by us01/11/2021b901Deposit ChargeDeposit charge4,715,615.760.004,715,615.7614,715,615.76
701/11/2021b776Other Recoverable ExpenseReletting fees for tenant348,000.000.00348,000.001348,000.00
801/11/2021b776Other Recoverable ExpenseLegal fees for tenant74,600.000.0074,600.00174,600.00
901/12/2021i011RentFor period 15/12/2021 to 14/03/20221,578,000.00252,480.001,830,480.0011,830,480.00
1001/12/2021i014Parking RentFor period 15/12/2021 to 14/03/2022231,000.0036,960.00267,960.001267,960.00
1101/03/2022i011RentFor period 15/03/2022 to 14/06/20221,578,000.00252,480.001,830,480.0011,830,480.00
1201/03/2022i014Parking RentFor period 15/03/2022 to 14/06/2022231,000.0036,960.00267,960.001267,960.00
13Add: payments made by ourselves not reflected in landlord01/07/20213487375,000.001375,000.00
14chq 3850 posted as 375500 instead of 375000500.001500.00
15less: payments made by ourselves not updated in ERP26/10/20211824- 401,542.85-1401,542.85
16less: deposit refund not posted in ERP25/11/2021- 9,358,656.00-19,358,656.00
17less credit note refund not posted by ourselves15/03/2022- 46,766.00-146,766.00
18Add: invoice posted in ERP not reflected in landlord, why ???- 2,075,878.92-12,075,878.92
19opening bal adjustmentMO4,527,542.0114,527,542.01
20tenant- 2,923,365.18-12,923,365.18
21Balance as per landlord- 568,071.1829,044,346.72
Problemdefined
Cell Formulas
RangeFormula
K2K2=COUNT(K6:K20)
I6:I20I6=J6:J20*K6:K20
J6:J20J6=LET(b,1-2*MID(BASE(SEQUENCE(2^K2)-1,2,K2),SEQUENCE(,K2),1), TRANSPOSE(XLOOKUP(I24,ROUND(MMULT(b,K6:K20),2),b)))
I21I21=SUM(I6#)
K21K21=SUM(K6:K20)
Dynamic array formulas.
Named Ranges
NameRefers ToCells
solver_adj=Problemdefined!$J$6:$J$20I6
solver_lhs1=Problemdefined!$J$10I6
solver_lhs10=Problemdefined!$J$19I6
solver_lhs11=Problemdefined!$J$20I6
solver_lhs12=Problemdefined!$J$6I6
solver_lhs13=Problemdefined!$J$7I6
solver_lhs14=Problemdefined!$J$8I6
solver_lhs15=Problemdefined!$J$9I6
solver_lhs2=Problemdefined!$J$11I6
solver_lhs3=Problemdefined!$J$12I6
solver_lhs4=Problemdefined!$J$13I6
solver_lhs5=Problemdefined!$J$14I6
solver_lhs6=Problemdefined!$J$15I6
solver_lhs7=Problemdefined!$J$16I6
solver_lhs8=Problemdefined!$J$17I6
solver_lhs9=Problemdefined!$J$18I6
 
Upvote 0
LET! It's a great function for making better formulas. My excel at work doesn't have it. Our IT department is slow to rollout changes.
 
Upvote 0

Forum statistics

Threads
1,223,610
Messages
6,173,339
Members
452,510
Latest member
RCan29

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