I'm using Access to populate some accounting forms and found an issue where it's add .01 to my excel sheets. The database is set to divide a number in half with 3 decimal places. The issue I'm having is, say the number after the division is 27.605 it's rounding both numbers to 27.61, which adds one penny when the two numbers are combined.
If 3rd decimal place is 5 or more I need to round up only on one number and need the other number to round down. This way when the two numbers are combined, it doesn't add one penny. I know it seems weird the way I've described but our company's forms factors surcharges and it was half of the surcharges twice in the spreadsheet. At the bottom of the spreadsheet it adds the two surcharge (half) totals together.
So I'm thinking
surcharge1 = equals half of the surcharge surcharge2 = the other half of the surcharge if the 3rd decimal place is 5 or more round surcharge1 up to the nearest penny and round surcharge2 down to the nearest penny. Any idea on how to make this function properly?
Int(100 * [MyField]) / 100)is supposed to round down to the nearest cent according to that link, yet it's rounding down to the nearest dollar. So $45.485 is actually rounding down to $45.00Surcharge2 = Round([half_surcharge], 2)which seems to be rounding down to the nearest cent.Roundusers bankers rounding (e.g. 20.5 rounded to 0 digits rounds to 20, while 21.5 rounds to 22)Int(100 * [MyField]) / 100)suggests it is doing integer division, but VBA does not perform integer division. Are you certain that there is no other code between that statement and the output?