• Minutes to Hours (2000 SP-3)

    Author
    Topic
    #413200

    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

    Viewing 2 reply threads
    Author
    Replies
    • #909583

      Put these two functions into a module :

      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

      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”))

    • #909584

      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

    • #909585

      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

    Viewing 2 reply threads
    Reply To: Minutes to Hours (2000 SP-3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: