How to group in Crystal Reports a field with contained values of 5's

I want to be able to group the unitCost value by increments of amount value in 5 in Crystal Reports 2008.
How is this accomplished?


Example:

Group 1
Item ID      Unitcost
AB123        1
AB124         2
AB125        3
AB126        5

Group 2
Item ID      Unitcost
CD123      6
CD124      6
CD125      7
CD126      10

Group 3
Item ID      Unitcost
CE123       11
CD124      12
CD127      14
CD128     15

Please help. Thanks.
Carlo VasquezAsked:
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.

mlmccCommented:
Add a formula like this and group on it

whilereadingrecords;
global numbervar myrecnum;
myrecnum:= myrecnum + 1;
myrecnum \ 5

Open in new window


The first group will only have 4 records but after that they should have 5
mlmcc
Carlo VasquezAuthor Commented:
mlmcc, I apologize I wrote it wrong....
I want the values in that field, unitCost, to be group by increments of every 5 dollar amounts.

So everything that has a value in UnitCost from 0 to 5 I Want it grouped.
Then everything from 6 to 10 I want it groups and so on...incremental values of 5 in the field.

Your answer was good though.
mlmccCommented:
Try this formula

{Value Field} \ 5

Open in new window

Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Carlo VasquezAuthor Commented:
Good call though but that didn't go to well since I have values of 0.00.
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
If you wish to call Group 0 Group 1, just add 1 to the expression mlmcc provided.
mlmccCommented:
If you have to have 0-5, 6-10

Try it this way

If ({ValueField} <= 5) then
    1
else If ({ValueField} <= 10) then
    2
else If ({ValueField} <= 15) then
    3
etc

Open in new window


You change it to

If ({ValueField} <= 5) then
    "0-5"
else If ({ValueField} <= 10) then
    "6-10"
else If ({ValueField} <= 15) then
    "11-15"
etc

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

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

Start your 7-day free trial
Carlo VasquezAuthor Commented:
Thanks mlmcc all I had to do then was group the report by that formula!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.