Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Posts
    146
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Minutes to Hours (2000 SP-3)

    Hi,

    Is there a way to convert minutes values to hours? For example, convert 76 minutes to 1:16?

    Also, can the converted hours values be added? For example, can 1:16 and 1:24 be added to automatically produce 2:40?

    Thanks,
    Bob

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Minutes to Hours (2000 SP-3)

    Put these two functions into a module :
    <pre>Function MinutesToHours(Minutes As Long) As String
    MinutesToHours = Int(Minutes / 60) & ":" & Minutes Mod 60
    End Function
    Function HoursToMinutes(Hours As String) As Long
    HoursToMinutes = Left(Hours, InStr(Hours, ":") - 1) * 60 + Val(Right(Hours, 2))
    End Function</pre>

    To convert 76 into 1:16 use:
    HoursToMinutes("1:16")
    To add 1:16 and 1:24 use :
    MinutesToHours (HoursToMinutes("1:16") + HoursToMinutes("1:24"))
    Francois

  3. #3
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Minutes to Hours (2000 SP-3)

    Bob

    See the attached zipped db.

    A table stores minutes and a query converts to hours/minutes. As for adding them well that's for another day!

    The query is based on a spread sheet I did for train times I did to remind me when to leave the office!

    Regards

    Graeme

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •