I need to amend this code to divide a given amount of money between a given number such that the amounts add up to exactly the total without rounding errors but keeping to two decimal places It does not matter if the amounts are not identical as this is not always possible e.g £100 / 3 but should minimise the differences as much as possible
If possible it should be able to predict the amounts rather than work by testing them after the divide has been done as this would be easier to intyegrate into theexising loop see below. I have set the critical calculation wiith error in bold
Thanks
intPersons = ubound(arrRows,2)+1
' loop over each person, guaranteed 1 or more iterations for intRow = 0 to ubound(arrRows,2) ' loop over each claim line topic , guaranteed 1 or more iteration. Create 1 line in the expport for each claim linetopic for intClaimLineRow = 0 to ubound(arrClaimLines,2) strClaimDetails = strClaimDetails & strTopic & " " & arrClaimLines(0,intClaimLineRow) & "," & arrClaimLines(1,intClaimLineRow)& _ ",£" & FormatNumber(FormatNumber(arrClaimLines(4,intClaimLineRow),2) / intPersons ) & "," & arrClaims(7,intClaimRow) & vbCrLF next next
