# Rounding time based on a minite given.

basically I need to convert times into the nearest 30min interval and based a mintue given by the user it allows the person to be late by that minute or leave early by that minute.
I will try to explain below:

IN RND is rounding back to the nearest 30min interval
if after that given min then it will round to the next
30min interval.
OUT RND is forward to the nearest 30min interval if within
a given min time before that 30 min interval.
if before that given min time then it will round back
to the earlier 30 min interval.
I have an example below for rounding given the
IN RND & OUT ROUND is 5mins :
The next example is of the data and in RED is what
I want a button to calculate.
The IN and OUT is for each ID for each day.
###### 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:
I'm a bit confused by your question, but if you want to round by time, say the nearest 15 minute interval per hour, the formula is below:
=ROUND(SUM(A2:A99)*96,0)/96

There are 96 quarter-hours in a day. Multiplying the total time by 96, rounding, and then dividing by 96 will give you the nearest quarter hour. If you want 30 min intervals, it would be 24, and so on, etc.

Do you have a sample file?
0
Author Commented:
example 1:
20/08/2011 5:03            5.00
20/08/2011 5:04            5.00
20/08/2011 5:05            5.30
20/08/2011 5:06            5.30
20/08/2011 5:07            5.30
20/08/2011 5:34            5.30
20/08/2011 5:35            6.00
20/08/2011 5:36            6.00
20/08/2011 6:03            6.00
20/08/2011 6:04            6.00
20/08/2011 6:05            6.30
20/08/2011 6:06            6.30
20/08/2011 6:33            6.30
20/08/2011 6:34            6.30
20/08/2011 6:35            7.00
20/08/2011 6:34            7.00
20/08/2011 7:03            7.00
20/08/2011 7:04            7.00
20/08/2011 7:05            7.30

example 2:
A      B            C      D      E
1                              IN RND      OUT RND
2                              5      5
3      ID      DATE / TIME
4      5      18/08/2011 4:58            5.00      AM
5      5      18/08/2011 14:53            2.30      PM
6      6      18/08/2011 5:03            5.00      AM
7      6      18/08/2011 15:10            3.00      PM
8      8      18/08/2011 5:08            5.30      AM
9      8      18/08/2011 15:20            3.00      PM
10      10      18/08/2011 5:32            5.30      AM
11      10      18/08/2011 14:27            2.30      PM
12      11      18/08/2011 5:28            5.30      AM
13      14      18/08/2011 5:35            6.00      AM
14      14      18/08/2011 15:45            3.30      PM
0
Commented:
OK, try this formula in cell A1

=ROUND(A1*288,0)/288

0
Commented:
whoops, try this for every 15 min:
=ROUND(A1*48,0)/48

the prior one is every 5 min
0
Author Commented:
Example file below
Example-Rounding.xlsx
0
Author Commented:
ok....that works using 24 to round to the nearest 30 min interval.....now what about the IN and OUT round values. I need to change the time by that figure of 5mins first then round. How do I add 5min to a time?
0
Commented:
TO add 5 min, use the TIME format. formula is below:

=A1+TIME(0,5,0)
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.

Author Commented:
thankyou...all works fine....used the following formula:
=ROUND((B4+TIME(0,(15-C2),0))*48,0)/48
0
Commented:
Great.
0
###### 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
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.