K
KeenKiwi
I am trying to replicate the way I believe a banking mainframe calculates
call account interest. Interest is calculated on the daily closing balance
through the month and posted as a single amount the following month. With
some simple calculations I can get within a few cents for the month, but it
is important I can do this to the exact cent. The rules appear to be:-
1) Where the balance or rate changes from day to day, the daily interest is
(balance * rate/360), rounded to 2 decimals.
2) Where the balance and rate are the same from day to day, the system
aggregates the balance, so the calculation is (sum of balances * rate/360) =
X.
3) X/days = Y, rounded to 2 decimals.
4) Y * days = interest.
I have the precise balance and rate for each day (Col A = date, Col B = bal,
Col C = rate). The balance and/or rate may change daily, or be constant for
several days. I have been able to get this far by a series of crude
calculations where I manually enter the number of days the balance and rate
are static. However, I need to automate this for many individual accounts,
bearing in mind that balances and rates are almost random (including being
positive or negative), and the varying length of months.
This community has never failed to amaze me with its knowledge and support,
so I will greatly appreciate all suggestions. Also, if anyone has actual
experience of how mainframes do this and thinks there are subtleties to the
calculation I have missed (or am barking up the wrong tree), please speak up.
call account interest. Interest is calculated on the daily closing balance
through the month and posted as a single amount the following month. With
some simple calculations I can get within a few cents for the month, but it
is important I can do this to the exact cent. The rules appear to be:-
1) Where the balance or rate changes from day to day, the daily interest is
(balance * rate/360), rounded to 2 decimals.
2) Where the balance and rate are the same from day to day, the system
aggregates the balance, so the calculation is (sum of balances * rate/360) =
X.
3) X/days = Y, rounded to 2 decimals.
4) Y * days = interest.
I have the precise balance and rate for each day (Col A = date, Col B = bal,
Col C = rate). The balance and/or rate may change daily, or be constant for
several days. I have been able to get this far by a series of crude
calculations where I manually enter the number of days the balance and rate
are static. However, I need to automate this for many individual accounts,
bearing in mind that balances and rates are almost random (including being
positive or negative), and the varying length of months.
This community has never failed to amaze me with its knowledge and support,
so I will greatly appreciate all suggestions. Also, if anyone has actual
experience of how mainframes do this and thinks there are subtleties to the
calculation I have missed (or am barking up the wrong tree), please speak up.