Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default hours / minutes

In my macro, I use the following code to return the total number of minutes
between 2 times:

TtlMins = Day2 - Day1
TtlMins = 545

What I want to do next is to return the number of hours (9) and the
remaining minutes (5) into 2 variables but I'm not having much luck

MyHrs = ????
MyMins = ???

If I try TtlMins / 60 - I get 9.03338 when all I want is 9 and then I want
to see 5 as the minutes left over

Any help or code suggestions would be greatly appreciated. Thanks for the
help

--
JT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default hours / minutes

MyHrs = Int(TtlMins / 60)
MyMins = TtlMins - MyHrs * 60

HTH.

Helmut.


"JT" schrieb im Newsbeitrag
...
In my macro, I use the following code to return the total number of minutes
between 2 times:

TtlMins = Day2 - Day1
TtlMins = 545

What I want to do next is to return the number of hours (9) and the
remaining minutes (5) into 2 variables but I'm not having much luck

MyHrs = ????
MyMins = ???

If I try TtlMins / 60 - I get 9.03338 when all I want is 9 and then I want
to see 5 as the minutes left over

Any help or code suggestions would be greatly appreciated. Thanks for the
help

--
JT



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default hours / minutes

Try this.
Code:
MyHrs = TtlMins \ 60

MyMins = TtlMins - MyHrs * 60
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default hours / minutes

On Apr 28, 5:01*am, norie wrote:
Try this.
Code:
 MyHrs = TtlMins \ 60

 MyMins = TtlMins - MyHrs * 60


Also can try following:
MyHrs = TtlMins \ 60
MyMins = TtlMins mod 60


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Decimal Minutes to Hours-Minutes-Seconds Scott Excel Programming 3 October 22nd 08 03:26 AM
Converting total minutes into hours and minutes in Excel colette Excel Worksheet Functions 11 December 26th 07 07:24 PM
converting Days Hours & minutes into just minutes in excel Six Sigma Blackbelt Excel Discussion (Misc queries) 5 April 28th 06 09:45 PM
how to change a decimal number (minutes) into hours and minutes? Erwin Excel Discussion (Misc queries) 2 November 5th 05 04:22 PM
add hours & minutes to other hours & minutes to receive total hou. Wes Excel Worksheet Functions 2 March 1st 05 11:33 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"