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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding

Status
Not open for further replies.

UOduck98

Technical User
May 2, 2005
2
US
Is it possible to RoundUP like in Excel? My excel data is not the same as my report because I can't find a way to round up to the next integer in the "tens" place. I know the Round ({field}, 3) - but it doesn't work the same. For instance

Employee 1 - 97.50% in Excel with the RoundUP formula, but the same employee in Crystal is 97.43%

Any ideas?

Thanks!
 
There is a RoundUp() function in the latest version of CR.
Before that you could use:
int(10*({mytable.myfield})+.999)/10
to round to 1 dp.
 
Try this formula:

Truncate({MyField}*10)/10+
if {MyField}-truncate({MyField*10)/10 in [.01 to .09] then .10 else 0


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Hello

This is how to always round up:

If {number.field} - truncate({number.field}) <> 0 then truncate({number.field})+1 else
{number.field}

The logic is that is when you truncate a number, you throw away any decimals. Subtract the truncated number from the original number and you can isolate the decimal part of the original number.

If the decimals are 0 then use the original number as it has no decimals. Otherwise add one to the truncated value and you have rounded the number with decimals up to the next integer value.

have fun

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top