• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1602
  • Last Modified:

Round a decimal value to the nearest quarter in Crystal Reports XI

I have a decimal value that I am pulling into a Crystal Report.  That value is then divided by 2.  After that I need to round it up to the nearest quarter.

Example:
The value of the field is 2.75
I divide that by 2 to get 1.37
I now need to round it up to 1.5 to be at the next quarter amount.

Any help will be greatly appreciated!!!!!!
0
PEAKTT
Asked:
PEAKTT
1 Solution
 
wykabryanCommented:
This formula should work for you.. Replace 2.769 with your column...

numbervar test:= round(2.769,2);
stringvar whole:= left(totext(test),instr(totext(test),".")-1);
numbervar half:= cdbl(right(totext(test),instr(totext(test),".")));
stringvar newwhole;


if half in [1 to 25]
    then newwhole:=whole+'.25'
    else
    if half in [26 to 50]
        then newwhole:= whole&'.50'
        else
        if half in [51 to 75]
        then newwhole:= whole&'.75'
        else
            if half in [76 to 99]
                then newwhole:= totext(cdbl(whole)+1);

cdbl(newwhole)
0
 
mlmccCommented:
You could modify this formula
http://www.kenhamady.com/form22.shtml

mlmcc
0
 
PEAKTTAuthor Commented:
Thank you so much!!!  Never thought to go from number to string to number.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now