PC Review


Reply
Thread Tools Rate Thread

convert hrs:min to minutes

 
 
Tonso
Guest
Posts: n/a
 
      31st Mar 2011
I have an xl2003 workbook that in F7 subtracts a time value in F5 from
a time value in F6. The time is manually entered into F5 and F6, which
are formatted "13;30" in the time format selection. The result is in
Hrs:Min format, so 15:20 - 13:30 = 1:50. I would the result, the 1:50,
to show in minutes, in this case 110 minutes. The entered times will
always be hrs:min, no seconds entered. What must I do to get the
result in minutes only? And, how do i handle when a time starts on one
day, say 11;30PM (23:50), and ends the next day at 1:50 [01:50)?

Thanks,

Tonso
 
Reply With Quote
 
 
 
 
joeu2004
Guest
Posts: n/a
 
      31st Mar 2011
On Mar 31, 7:14*am, Tonso <wthoma...@hotmail.com> wrote:
> The result is in Hrs:Min format, so 15:20 - 13:30 = 1:50.
> I would the result, the 1:50, to show in minutes, in this
> case 110 minutes.


If you just want to change the displayed value, use the format Custom
[m] .

But note that Excel time is stored as a fraction of 1 day. So 1 hr is
1/24, 1 min is 1/1440, and 1 sec is 1/86400.

If instead you want the value of the result to be an integer, use the
following formula:

=ROUND((F6-F5)*1440,0)

The use of ROUND eliminates anomalies that arise because of the way
that Excel (and most applications normally) store numbers, namely
binary floating-point.


> And, how do i handle when a time starts on one day, say
> 11;30PM (23:50), and ends the next day at 1:50 [01:50)?


The best way: record date as well as time. Then no change is needed.

But if you record only time, then compute the difference as:

=F6-F5+(F5>F6)

formatted as Custom [m] .

 
Reply With Quote
 
GS
Guest
Posts: n/a
 
      31st Mar 2011
Another way if you want to use the same formula in all cases...

StartTime entered in A1
StopTime entered in B1
ElapsedTime returned in C1 with the following formula:

=ROUND(IF(B1>A1,(B1-A1)*1440,IF(B1<A1,((B1+1)-A1)*1440,"")),0)

Formula assumes time values are entered correctly for AM/PM.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
The_Giant_Rat_of_Sumatra
Guest
Posts: n/a
 
      1st Apr 2011
On Thu, 31 Mar 2011 16:21:40 -0400, GS <(E-Mail Removed)> wrote:

>Another way if you want to use the same formula in all cases...
>
> StartTime entered in A1
> StopTime entered in B1
> ElapsedTime returned in C1 with the following formula:
>
> =ROUND(IF(B1>A1,(B1-A1)*1440,IF(B1<A1,((B1+1)-A1)*1440,"")),0)
>
>Formula assumes time values are entered correctly for AM/PM.


This is what I put in "H13" (because my two cells are G13 and F13. This
keeps the tally cell blank, unless both time cells have data. It could
be modified to use the integer version quite easily, IIRC. The times
were entered in 24 Hr format and no date info.

=IF(IF((OR(G13="",F13="")),0,IF((G13<F13),((G13-F13)*24)+24,(G13-F13)*24))=0,"",IF((OR(G13="",F13="")),0,IF((G13<F13),((G13-F13)*24)+24,(G13-F13)*24)))
 
Reply With Quote
 
GS
Guest
Posts: n/a
 
      1st Apr 2011
> This is what I put in "H13" (because my two cells are G13 and F13. This
> keeps the tally cell blank, unless both time cells have data. It could
> be modified to use the integer version quite easily, IIRC. The times
> were entered in 24 Hr format and no date info.
>
> =IF(IF((OR(G13="",F13="")),0,IF((G13<F13),((G13-F13)*24)+24,(G13-F13)*24))=0,"",IF((OR(G13="",F13="")),0,IF((G13<F13),((G13-F13)*24)+24,(G13-F13)*24)))


I use something similar, just shorter...

What I posted was a (modified to calc minutes) version of something I
use to track time worked on projects. Here's what I use for calcing
elapsed time in hours (formatted as "#.00"), based on Start/Stop times
not being empty. (All 1 line...)

=IF(AND(Start<>"",Stop<>"",Stop>Start),(Stop-Start)*24,
IF(AND(Start<>"",Stop<>"",Stop<Start),((Stop+1)-Start)*24,
""))

Also, no date info and times are entered in AM/PM format.
(Actually, this is the result of Ctrl+; being used to record time
on the fly for work done on projects)

Start (ColAbsolute-RowRelative) is entered in ColF;
Stop (ColAbsolute-RowRelative) is entered in ColG;
ElapsedTime is calced in ColH using the above formula.

Cols I/J calc month totals (date required for each entry) and
sub-project totals. (sheet supports sub-projects under a main project)
Project billing total is calced elsewhere on the sheet based on rate
for services provided.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
Claus Busch
Guest
Posts: n/a
 
      1st Apr 2011
Hi Garry,

Am Thu, 31 Mar 2011 16:21:40 -0400 schrieb GS:

> Another way if you want to use the same formula in all cases...
>
> StartTime entered in A1
> StopTime entered in B1
> ElapsedTime returned in C1 with the following formula:
>
> =ROUND(IF(B1>A1,(B1-A1)*1440,IF(B1<A1,((B1+1)-A1)*1440,"")),0)


a little bit shorter:
=ROUND(MOD(B1-A1,1)*1440,0)


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
 
Reply With Quote
 
GS
Guest
Posts: n/a
 
      2nd Apr 2011
After serious thinking Claus Busch wrote :
> Hi Garry,
>
> Am Thu, 31 Mar 2011 16:21:40 -0400 schrieb GS:
>
>> Another way if you want to use the same formula in all cases...
>>
>> StartTime entered in A1
>> StopTime entered in B1
>> ElapsedTime returned in C1 with the following formula:
>>
>> =ROUND(IF(B1>A1,(B1-A1)*1440,IF(B1<A1,((B1+1)-A1)*1440,"")),0)

>
> a little bit shorter:
> =ROUND(MOD(B1-A1,1)*1440,0)
>
>
> Regards
> Claus Busch


Thanks Claus! I'll give this a try...

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
GS
Guest
Posts: n/a
 
      2nd Apr 2011
GS made this correction :
> ...this is the result of Ctrl+; being used...


I made a typo! The above should read:

...this is the result of Ctrl+: being used...

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
GS
Guest
Posts: n/a
 
      2nd Apr 2011
Very nice! Well appreciated...

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


 
Reply With Quote
 
The_Giant_Rat_of_Sumatra
Guest
Posts: n/a
 
      2nd Apr 2011
On Fri, 1 Apr 2011 18:29:41 +0200, Claus Busch <(E-Mail Removed)>
wrote:

>a little bit shorter:
>=ROUND(MOD(B1-A1,1)*1440,0)
>
>
>Regards
>Claus Busch



You forgot the 'blank until times are filled' mode. We were not
discussing shortening.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert text entered as minutes/seconds to minutes Kathie Microsoft Excel Worksheet Functions 1 6th May 2010 05:05 AM
Convert Decimal Minutes to Hours-Minutes-Seconds Scott Microsoft Excel Programming 3 22nd Oct 2008 03:26 AM
How do I convert 184 minutes into 3:04 (3 hours:4 minutes) in EXCE =?Utf-8?B?dHBlbmR5?= Microsoft Excel Misc 2 18th Oct 2005 02:28 AM
How do I convert a number of minutes into hours and minutes? =?Utf-8?B?Z3lya2lu?= Microsoft Excel Worksheet Functions 3 18th Aug 2005 11:12 PM
MOD Function or how to convert total minutes to hours and minutes Brad Microsoft Access Reports 1 22nd Dec 2004 08:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.