Print Page | Close Window

"Banker's" rounding

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20334
Printed Date: 29 Apr 2024 at 12:46am


Topic: "Banker's" rounding
Posted By: crystalnewbie33
Subject: "Banker's" rounding
Date Posted: 09 Jan 2014 at 5:28am
I use Crystal to create reports that work with data from MySql. MySql uses banker's rounding(rounding down from .5) but Crystal does not. Is there a way to force Crystal to use banker's rounding? In other words, I want 1010.265 to round to 1010.26 instead of 1010.27.



Replies:
Posted By: DBlank
Date Posted: 09 Jan 2014 at 5:53am
an idea..
in theory could you subtract .001 from the value and then use the regular rounding function. I think this would only change the final rounding result for records that have the .xx5.
otherwise you could use an if then to subtract the .001 only when the 3rd decimal=5...


Posted By: crystalnewbie33
Date Posted: 09 Jan 2014 at 6:08am
Great idea! I have added the subtraction to the formula and am using the regular rounding. So far I am getting the desired result every time, I will continue to test and see if I come across any issues.



Print Page | Close Window