Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Rounding duration within 20 min intervals

Posted on 2016-10-19
Medium Priority
67 Views
I have a value (Duration) in Crystal reports that I want to classify in 0-20 minute intervals. i.e. every 20 mins in a day falls within a specific timeframe and gets assigned a value :-

I'm assuming something like below would need to be compiled.
(if duration <= 20 then 1 else if (duration >20 and duration <=40) then 2).....etc, I would need 71 of these.

0 - 20mins = 1
21 - 40mins = 2
41 - 60mins = 3
....................................

1401 - 1420 mins = 70
1421 - 1440 mins = 71

Below duration values would fall within the above mentioned

13mins         (0-20mins) = (1)
507mins       (500 - 520mins) = (26)
907mins       (900-920mins) = (46)
1358mins    (1340-1360mins) = (68)

Is there an easier way to do this in Crystal ?
0
Question by:John-S Pretorius
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 52

Accepted Solution

Rgonzo1971 earned 2000 total points
ID: 41850394
Hi,

pls try

``````=Fix((YourDuration-0.1)/20, 0)+1
``````
Regards
1

Author Closing Comment

ID: 41850419
Perfect Sir, Thank you.
0

LVL 101

Expert Comment

ID: 41850735
In Crystal there is an integer division operator

This will give you 0 to max
``````{YourDurationField} \ 20
``````

If you want to start at 1 then just add 1
``````{YourDurationField} \ 20 + 1
``````

mlmcc
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
###### Suggested Courses
Course of the Month7 days, 19 hours left to enroll