phone: (540)338-0194
email: ken@kenhamady.com

´╗┐

 Crystal Reports formula examples

Rounding to the nearest 5 cents (or other odd increment):

Rounding to the nearest penny, dime, dollar or thousand dollars is simply a matter of using the round function and specifying the correct number of decimals.  Recently a reader sent me a formula that was supposed to round to the nearest nickel.  The formula didn't work and seemed too complex to fix, so I wrote my own formula and shared it with my newsletter readers.   As soon as I did, one of my readers gave me an even simpler version.  Here it is and thanks to Mike Barron who told me that he found this formula long ago on an Excel forum

What I like most about this approach, other than the sheer simplicity, is that you could replace the ".05" with any odd increment and the rounding will be based on that increment. 



    Round ( {database.field} / .05 , 0 ) * .05