Sum of rounded values to equal original value

gobblechops

New Member
Joined
Apr 27, 2017
Messages
40
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a random monetary value that is divided by a random number between 2 and 12.

For example £6,992.00 divided by 6 = 6 equal amounts (after using the ROUND formula) of £1,165.33.

I need the sum of the rounded instalments to always equal the original value (in this case £6,992.00).

I would like the last instalment to automatically carry the difference of £0.02.

Any help appreciated,

Thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
How about this? Only guessing at the layout of your data, so the formula may need to be adjusted.


=IF((COLUMN()-2)>$B1,"",IF((COLUMN()-2)=$B1,$A$1-SUM(B1:$C1),ROUND($A$1/$B1,0)))

I assumed A1 held the amount, B1 held the divisor and the installments dragged to the right columns C1:N1 with sum of installments in column O.
 
Upvote 0
Here's a VBA solution as well.

Code:
Sub Payments()
Dim Total       As Double: Total = Application.InputBox("Enter Amount")
Dim Payments    As Integer: Payments = Application.InputBox("Enter Payments")
Dim Initial     As Double: Initial = Round(Total / Payments, 2)
Dim AR          As Variant


ReDim AR(1 To Payments)


For i = 1 To Payments
    If i < Payments Then
        AR(i) = Initial
        Total = Total - Initial
    Else
        AR(i) = Total
    End If
Next i


Range("A1").Resize(Payments, 1).Value = Application.Transpose(AR)
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,842
Members
449,471
Latest member
lachbee

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