# 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!!!!!!
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
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

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
You could modify this formula