# Convert elapsed time value into nearest 10th of an hour

I have a variable called ElapsedTime which represents the number of seconds between the StartTime and the current time.

Dim ElapsedTime As Long
ElapsedTime = Timer - StartTime

I want a function that convert this numer of seconds by rounding up to the nearest 10th of an hour, like this:

1-6 minutes = .1
6-12 minutes = .2
12-18 minutes = .3
18-24 minutes = .4
24-30 minutes = .5
30-36 minutes = .6
36-42 minutes = .7
42-48 minutes = .8
48-54 minutes = .9
54-60 minutes = 1.0
60-66 minutes = 1.1
etc.

What is the best way to accomplish this?  Thank you.
###### 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:
Hi,

You can use Round(dblElapsed, 1). BTW: if you declare ElapsedTime as Long, you will always get rounded seconds in your code. The conversion to long will be implicit in the assignation.
Timer returns a Single value.

Cheers!
(°v°)
0
Commented:
Sorry, misread. Let me try again...
0
Commented:
One hour = 3600 seconds, so use:

Round( ElapsedSeconds * 3600, 1 )

Cheers!
(°v°)
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:
that was quick and simple.  thanks for the help.
0
Commented:
Still not what you seem to want... Your text says "to the nearest" but your sample says otherwise.

Perhaps: round to the nearest minute and then round up to the nearest 10th?

( ( Round(ElapsedSeconds / 60)  + 5 ) \ 6 ) / 10

Also, it should have been /3600 and not *3600 in my previous post, obviously ;)
(°v°)

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 Access

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.