Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Percentage rounding

Status
Not open for further replies.

jaguar00

Programmer
Oct 17, 2003
40
US
Hi all! I'm using CR10/SQL/ODBC and have a number field which is actually being used as a percentage. Some values are whole numbers but occationally I have a percentage of 45.5. On my report all the numbers are printing out as whole numbers but when it gets to the 45.5 type number, it rounds automatically to 46 which I don't want. When I try to format the field in the number tab under the Format Editor, it puts the .0 on the end of the whole numbers which I don't want.

The end printed results should look like the following:

30
40
45.5
50
50.5
etc.

How do I format this to give me this type of result?

Any assistance is greatly appreciated as I've been searching on this all day.
Thanks!
 
You need to coditionally set the number of decimals.

Right click the field and select format field. On the number tab, click on the customize button. Then click the X-2 button to the right of the decimals drop down box and enter a formula:

If Int({YourField})-{YourField} = 0 then 0 else 1.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top