Is there a formula to rebalance investment funds?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,713
Office Version
  1. 365
Platform
  1. Windows
Suppose I have 3 index funds as shown in the minisheet below. My investment strategy asks that I try to maintain the 3 funds so that A is 50%, B is 40% and C is 10%. As you can see, A is at 59% or 9% too high, B is at 26% or 14% too low. C is at 15% or 5% too high.

Suppose I want to withdraw $50,000 from this account. I would like to do it so as to bring the funds as close to the target percentages as possible. In the Withdrawal Amount column, I found the correct allocation by trial and error.

Is there a formula that will calculate the best way to divide up a withdrawal from 3 index funds to achieve the best balance? Or do I need to write a macro that will do the trial and error for me?

Thanks

Rebalance.xlsx
BCDEFGHIJKLM
3$224,245.86Current Total (TotOld)
4$50,000.00Withdrawal Amount (WDAmt)
5$174,245.86Adjusted Total (TotAdj)Table Name: TblRebalMan
6FundTarget %Old BalancesOld %Old % - Tgt %Target BalancesTarget Rebalance △Withdrawal AmountRebalanced BalanceTarget - ActualRebalanced %Rebalanced% - Target%
7A50%$131,931.4658.83%+8.83%$87,122.93-$44,808.53$39,524.36$92,407.10-$5,284.1753.03%+3.03259%
8B40%$59,130.0026.37%-13.63%$69,698.34+$10,568.34$0.00$59,130.00+$10,568.3433.93%-6.06519%
9C10%$33,184.4014.80%+4.80%$17,424.59-$15,759.81$10,475.64$22,708.76-$5,284.1713.03%+3.03260%
10Total100%$224,245.86100.00%0.00%$174,245.86-$50,000.00$50,000.00$174,245.86$0.00100.00%+0.00000%
Rebalance Manual
Cell Formulas
RangeFormula
D3D3=TblRebalMan[[#Totals],[Old Balances]]
E3E3="Current Total (" & GetRangeName(TotOld) & ")"
E4E4="Withdrawal Amount (" & GetRangeName(WDAmt) & ")"
D5D5=TblRebalMan[[#Totals],[Old Balances]]-WDAmt
E5E5="Adjusted Total (" & GetRangeName(TotAdj) & ")"
I5I5=+GetTableName(TblRebalMan[[#Headers],[Fund]])
E7:E9E7=[@[Old Balances]]/TblRebalMan[[#Totals],[Old Balances]]
F7:F9F7=[@[Old %]]-[@[Target %]]
G7:G9G7=[@[Target %]]*TotAdj
H7:H9H7=[@[Target Balances]]-[@[Old Balances]]
J7:J9J7=[@[Old Balances]]-[@[Withdrawal Amount]]
K7:K9K7=[@[Target Balances]]-[@[Rebalanced Balance]]
L7:L9L7=[@[Rebalanced Balance]]/TblRebalMan[[#Totals],[Rebalanced Balance]]
M7:M9M7=[@[Rebalanced %]]-[@[Target %]]
I9I9=WDAmt-TAKE([Withdrawal Amount],1)
C10C10=SUBTOTAL(109,[Target %])
D10D10=SUBTOTAL(109,[Old Balances])
E10E10=SUBTOTAL(109,[Old %])
F10F10=SUBTOTAL(109,[Old % - Tgt %])
G10G10=SUBTOTAL(109,[Target Balances])
H10H10=SUBTOTAL(109,[Target Rebalance △])
I10I10=SUBTOTAL(109,[Withdrawal Amount])
J10J10=SUBTOTAL(109,[Rebalanced Balance])
K10K10=SUBTOTAL(109,[Target - Actual])
L10L10=SUBTOTAL(109,[Rebalanced %])
M10M10=SUBTOTAL(109,[Rebalanced% - Target%])
Named Ranges
NameRefers ToCells
'Rebalance Manual'!TotAdj='Rebalance Manual'!$D$5E5, G7:G9
'Rebalance Manual'!TotOld='Rebalance Manual'!$D$3E3
'Rebalance Manual'!WDAmt='Rebalance Manual'!$D$4I9, E4, D5
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
The formulae I'd be inclined to use are along the lines of:
VBA Code:
G7: =C$5*B7: H7: =G7-C7: I7: =IF(H7<0,H$10/SUMIF(H$7:H$9,"<0",H$7:H$9)*H7,0): Withdrawn: -$36,990.32: New Bal: $94,941.14: New %: 54.5
G8: =C$5*B8: H8: =G8-C8: I8: =IF(H8<0,H$10/SUMIF(H$7:H$9,"<0",H$7:H$9)*H8,0): Withdrawn:  $     0.00: New Bal: $59,130.00: New %: 33.9
G9: =C$5*B9: H9: =G9-C9: I9: =IF(H9<0,H$10/SUMIF(H$7:H$9,"<0",H$7:H$9)*H9,0): Withdrawn: -$13,009.68: New Bal: $20,174.32: New %: 11.6
The 'balanced' figures are different from yours because the out-of-balance figures are reduced by the same proportions.
 
Upvote 0
The formulae I'd be inclined to use are along the lines of:
VBA Code:
G7: =C$5*B7: H7: =G7-C7: I7: =IF(H7<0,H$10/SUMIF(H$7:H$9,"<0",H$7:H$9)*H7,0): Withdrawn: -$36,990.32: New Bal: $94,941.14: New %: 54.5
G8: =C$5*B8: H8: =G8-C8: I8: =IF(H8<0,H$10/SUMIF(H$7:H$9,"<0",H$7:H$9)*H8,0): Withdrawn:  $     0.00: New Bal: $59,130.00: New %: 33.9
G9: =C$5*B9: H9: =G9-C9: I9: =IF(H9<0,H$10/SUMIF(H$7:H$9,"<0",H$7:H$9)*H9,0): Withdrawn: -$13,009.68: New Bal: $20,174.32: New %: 11.6
The 'balanced' figures are different from yours because the out-of-balance figures are reduced by the same proportions.
My objective is for the rebalanced %s to all differ from the target %s by an equal amount. In my example, the %△s both equal 3.02% (last column). I think that guarantees that they will both be equally close to their target %s. I think that is the definition of "balanced" (or more closely balanced). First table below.

If I implemented your solution correctly in the second table below, you withdraw more from Fund C and less from Fund A, so C is closer to its target % (+1.58% vs +4.49%). Let me know if I did that wrong.

Lacking a closed form expression, I think the only solution is a macro that implements my manual solution. It will test different values for the withdrawal amounts until the %△s are equal. Let me know if you see a closed form solution.

Cell Formulas
RangeFormula
D3D3=TblRebalMan[[#Totals],[Old Balances]]
E3E3="Current Total (" & GetRangeName(TotOld) & ")"
E4E4="Withdrawal Amount (" & GetRangeName(WDAmt) & ")"
D5D5=TblRebalMan[[#Totals],[Old Balances]]-WDAmt
E5E5="Adjusted Total (" & GetRangeName(TotAdj) & ")"
I5I5=+GetTableName(TblRebalMan[[#Headers],[Fund]])
E7:E9E7=[@[Old Balances]] / TblRebalMan[[#Totals],[Old Balances]]
F14:F16,F7:F9F7=[@[Old %]] - [@[Target %]]
G14:G16,G7:G9G7=TotAdj * [@[Target %]]
H14:H16,H7:H9H7=[@[Target Balances]] - [@[Old Balances]]
J7:J9J7=[@[Old Balances]] - [@[Withdrawal Amount]]
K14:K16,K7:K9K7=[@[Target Balances]] - [@[Rebalanced Balance]]
L14:L16,L7:L9L7=[@[Rebalanced Balance]] / TblRebalMan[[#Totals],[Rebalanced Balance]]
M14:M16,M7:M9M7=[@[Rebalanced %]] - [@[Target %]]
I9I9=WDAmt-TAKE([Withdrawal Amount],1)
C10,C17C10=SUBTOTAL(109,[Target %])
D10,D17D10=SUBTOTAL(109,[Old Balances])
E10,E17E10=SUBTOTAL(109,[Old %])
F10,F17F10=SUBTOTAL(109,[Old % - Tgt %])
G10,G17G10=SUBTOTAL(109,[Target Balances])
H10,H17H10=SUBTOTAL(109,[Target Rebalance △])
I10,I17I10=SUBTOTAL(109,[Withdrawal Amount])
J10,J17J10=SUBTOTAL(109,[Rebalanced Balance])
K10,K17K10=SUBTOTAL(109,[Target - Actual])
L10,L17L10=SUBTOTAL(109,[Rebalanced %])
M10,M17M10=SUBTOTAL(109,[Rebalanced% - Target%])
I12I12=+GetTableName(TblRebalMrEx[[#Headers],[Fund]])
B14:D16C14=C7
E14:E16E14=[@[Old Balances]] / TblRebalMrEx[[#Totals],[Old Balances]]
I14:I16I14=IF([@[Target Rebalance △]]<0,TblRebalMrEx[[#Totals],[Target Rebalance △]]/SUMIF([Target Rebalance △],"<0",[Target Rebalance △])*[@[Target Rebalance △]],0)
J14:J16J14=[@[Old Balances]] + [@[Withdrawal Amount]]
Named Ranges
NameRefers ToCells
TotAdj=Rebalance!$D$5E5, G7:G9, G14:G16
TotOld=Rebalance!$D$3E3
WDAmt=Rebalance!$D$4I9, E4, D5
 
Upvote 0
Hi Jennifer,

Yes, you implemented my 'solution' correctly and the results were as expected - it reduces each of the out-of-balance amounts by 17.45% of the imbalance.
 
Upvote 0
Hi Jennifer,

Yes, you implemented my 'solution' correctly and the results were as expected - it reduces each of the out-of-balance amounts by 17.45% of the imbalance.
Two questions:
  1. What is the logic behind that solution? Where did the 17.45% come from?
  2. Do you disagree with my objective that the % differences in the adjusted balances be equal?
 
Upvote 0
Hi Jennifer,

Re:
1. If you add up the target rebalance amounts for A & C, you'll see they come to -$60,568.18. Dividing -$60,568.18 by the target withdrawal of -$50,000 = 0.8255, or 82.55%. Then 100%-82.55% = 17.45%
2. Not at all. I simply worked with a different definition of what rebalancing might require - reducing the out-of-balance amounts for A & C by the same proportion. Another definition might require getting the $ imbalance for A & C equal. For your target % figures to be as near as practical the same, you'd need to use something like:
=(D7>B7)*((((SUMIF(H$7:H$9,"<0",C$7:C$9)+C$4)/C$5-SUMIF(H$7:H$9,"<0",B$7:B$9))/2+B7)*G$10-C7)
in I7 and copy down to I9. This will give -$39,524.64 for A and -$10,475.36 for C. These are the correct amounts for the equal % differences.
 
Last edited:
Upvote 0
Hi Jennifer,

For your target % figures to be as near as practical the same, you'd need to use something like:
=(D7>B7)*((((SUMIF(H$7:H$9,"<0",C$7:C$9)+C$4)/C$5-SUMIF(H$7:H$9,"<0",B$7:B$9))/2+B7)*G$10-C7)
in I7 and copy down to I9. This will give -$39,524.64 for A and -$10,475.36 for C. These are the correct amounts for the equal % differences.

Wow!!! That seems to work, sorta. A couple of glitches:
  1. I had to change two of your column letters (D to E & B to C).
  2. I replaced cell addresses with named ranges (D4(C4) is WDAmt, D5(C5) is TotAdj, & G10 is also TotAdj).
  3. In my implementation, it gets the two withdrawal amounts reversed. I can correct that by subtracting the amounts that are >0 from WDAmt, but I would like to understand why they are reversed.
I can't get my head around it. Can you explain what it is doing? And why the values are reversed?

Thanks

Cell Formulas
RangeFormula
D3D3=TblRebalMrEx[[#Totals],[Old Balances]]
E3E3="Current Total (" & GetRangeName(TotOld) & ")"
E4E4="Withdrawal Amount (" & GetRangeName(WDAmt) & ")"
D5D5=TblRebalMrEx[[#Totals],[Old Balances]]-WDAmt
E5E5="Adjusted Total (" & GetRangeName(TotAdj) & ")"
I5I5=+GetTableName(TblRebalMrEx[[#Headers],[Fund]])
E7:E9E7=[@[Old Balances]] / TblRebalMrEx[[#Totals],[Old Balances]]
F7:F9F7=[@[Old %]] - [@[Target %]]
G7:G9G7=TotAdj * [@[Target %]]
H7:H9H7=[@[Target Balances]] - [@[Old Balances]]
I7:I9I7=([@[Old %]]>[@[Target %]])*((((SUMIF([Target Rebalance △],"<0",[Old Balances])+WDAmt)/TotAdj-SUMIF([Target Rebalance △],"<0",[Target %]))/2+[@[Target %]])*TotAdj-[@[Old Balances]])
J7:J9J7=[@[Old Balances]] - [@[Withdrawal Amount]]
K7:K9K7=[@[Target Balances]] - [@[Rebalanced Balance]]
L7:L9L7=[@[Rebalanced Balance]] / TblRebalMrEx[[#Totals],[Rebalanced Balance]]
M7:M9M7=[@[Rebalanced %]] - [@[Target %]]
O7:O9O7=(E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)+WDAmt)/TotAdj-SUMIF(H$7:H$9,"<0",C$7:C$9))/2+C7)*TotAdj-D7)
C10C10=SUBTOTAL(109,[Target %])
D10D10=SUBTOTAL(109,[Old Balances])
E10E10=SUBTOTAL(109,[Old %])
F10F10=SUBTOTAL(109,[Old % - Tgt %])
G10G10=SUBTOTAL(109,[Target Balances])
H10H10=SUBTOTAL(109,[Target Rebalance △])
I10I10=SUBTOTAL(109,[Withdrawal Amount])
J10J10=SUBTOTAL(109,[Rebalanced Balance])
K10K10=SUBTOTAL(109,[Target - Actual])
L10L10=SUBTOTAL(109,[Rebalanced %])
M10M10=SUBTOTAL(109,[Rebalanced% - Target%])
Named Ranges
NameRefers ToCells
TotAdj=Rebalance!$D$5E5, G7:G9, O7:O9, I7:I9
TotOld=Rebalance!$D$3E3
WDAmt=Rebalance!$D$4E4, D5, O7:O9, I7:I9
 
Upvote 0
OK, I missed that your screenshot starts at column B. The formula should have been:
=(E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)+D$4)/D$5-SUMIF(H$7:H$9,"<0",C$7:C$9))/2+C7)*G$10-D7)

I'm not sure what you've done but, not only are the withdrawal amounts for A & C swapped, they're also expressed as +ve values instead of -ve.
When I input:
=(E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)+WDAmt)/TotAdj-SUMIF(H$7:H$9,"<0",C$7:C$9))/2+C7)*TotAdj-D7)
into O7, I get the correct values.

A more flexible version of the formula would be:
=MAX((E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)+D$4)/D$5-SUMIF(H$7:H$9,"<0",C$7:C$9))/COUNTIF(H$7:H$9,"<0")+C7)*G$10-D7),D$4)
This allows for more (or less) than three index funds (by expanding the row 7-9 range) and, in the event there's only one that's eligible for drawdown, limits the nominated amount to the withdrawal value.

Edit: I just figured it out. You have a +ve value for the WDAmt, whereas I used a -ve value. make that change and make D5 =TotOld-WDAmt and everything will be fine.
 
Upvote 0
OK, I missed that your screenshot starts at column B. The formula should have been:
=(E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)+D$4)/D$5-SUMIF(H$7:H$9,"<0",C$7:C$9))/2+C7)*G$10-D7)

I'm not sure what you've done but, not only are the withdrawal amounts for A & C swapped, they're also expressed as +ve values instead of -ve.
When I input:
=(E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)+WDAmt)/TotAdj-SUMIF(H$7:H$9,"<0",C$7:C$9))/2+C7)*TotAdj-D7)
into O7, I get the correct values.

A more flexible version of the formula would be:
=MAX((E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)+D$4)/D$5-SUMIF(H$7:H$9,"<0",C$7:C$9))/COUNTIF(H$7:H$9,"<0")+C7)*G$10-D7),D$4)
This allows for more (or less) than three index funds (by expanding the row 7-9 range) and, in the event there's only one that's eligible for drawdown, limits the nominated amount to the withdrawal value.
Can I bother you to express your more flexible version in words? Or, better yet, in code? I would really like to get my head around the logic and I'll probably put it in a macro.
 
Upvote 0
Here's the basic formula to work with your +ve withdrawal value:
=(E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)-WDAmt)/-TotAdj+SUMIF(H$7:H$9,"<0",C$7:C$9))/2-C7)*-TotAdj-D7)
and, for the more flexible version:
=MAX((E7>C7)*((((SUMIF(H$7:H$9,"<0",D$7:D$9)-WDAmt)/-TotAdj+SUMIF(H$7:H$9,"<0",C$7:C$9))/2-C7)*-TotAdj-D7),-WDAmt)
I'll work on the code/narrative version...
 
Upvote 0

Forum statistics

Threads
1,226,112
Messages
6,189,044
Members
453,521
Latest member
Chris_Hed

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