A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Time calculations over 24hrs



 
 
Thread Tools Display Modes
  #1  
Old May 6th, 2010, 11:32 AM posted to microsoft.public.excel.worksheet.functions
Ian R[_4_]
external usenet poster
 
Posts: 3
Default Time calculations over 24hrs

Hi

I'm using Excel 2003.

I'm trying to calculate the total hours (C1) by subtracting end time
(B1) from start time (A1)

I have formatted the cells for time.

I'm currently using B1-A1 which works OK until the end time goes past
midnight.

e.g start 19:50 end 00:20 should = 4:30 except i just get an endless
series of #######

Thanks for your time.

Ian
  #2  
Old May 6th, 2010, 11:53 AM posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Time calculations over 24hrs

On Thu, 6 May 2010 11:32:35 +0100, Ian R wrote:

Hi

I'm using Excel 2003.

I'm trying to calculate the total hours (C1) by subtracting end time
(B1) from start time (A1)

I have formatted the cells for time.

I'm currently using B1-A1 which works OK until the end time goes past
midnight.

e.g start 19:50 end 00:20 should = 4:30 except i just get an endless
series of #######

Thanks for your time.

Ian



For up to 24 hrs:

=B1-A1+(B1=A1)

Format result as h:mm

For more than 24 hours, you will have to include the date also, and format the
result as [h]:mm

--ron
  #3  
Old May 6th, 2010, 11:59 AM posted to microsoft.public.excel.worksheet.functions
Steve Dunn
external usenet poster
 
Posts: 192
Default Time calculations over 24hrs

Hi Ian,

That's because Excel sees 00:20 (without a date) as being less than 19:50,
and Excel doesn't recognise the viability of time-travel. i.e. you can't
have a negative expression of time.

Actually, I'm a little confused by your question; you state that you are
subtracting B1 from A1, but show your formula as B1-A1, which is the other
way around. For this I will assume you have start time in A1 and end time
in B1, so your formula would have been correct rather than your description.

To get around your problem you have to let Excel know that 00:20 is actually
the next day, which you can do by adding 1 to it when B1 is less than A1.
This will achieve that:

=B1+(B1A1)-A1


HTH
Steve D.


"Ian R" wrote in message
m...
Hi

I'm using Excel 2003.

I'm trying to calculate the total hours (C1) by subtracting end time
(B1) from start time (A1)

I have formatted the cells for time.

I'm currently using B1-A1 which works OK until the end time goes past
midnight.

e.g start 19:50 end 00:20 should = 4:30 except i just get an endless
series of #######

Thanks for your time.

Ian


  #4  
Old May 6th, 2010, 12:06 PM posted to microsoft.public.excel.worksheet.functions
Steve Dunn
external usenet poster
 
Posts: 192
Default Time calculations over 24hrs

Comparing Ron's answer to mine raises another question, how do you want
Excel to deal with A1=B1?




"Steve Dunn" wrote in message
...
Hi Ian,

That's because Excel sees 00:20 (without a date) as being less than 19:50,
and Excel doesn't recognise the viability of time-travel. i.e. you can't
have a negative expression of time.

Actually, I'm a little confused by your question; you state that you are
subtracting B1 from A1, but show your formula as B1-A1, which is the other
way around. For this I will assume you have start time in A1 and end time
in B1, so your formula would have been correct rather than your
description.

To get around your problem you have to let Excel know that 00:20 is
actually the next day, which you can do by adding 1 to it when B1 is less
than A1. This will achieve that:

=B1+(B1A1)-A1


HTH
Steve D.


"Ian R" wrote in message
m...
Hi

I'm using Excel 2003.

I'm trying to calculate the total hours (C1) by subtracting end time
(B1) from start time (A1)

I have formatted the cells for time.

I'm currently using B1-A1 which works OK until the end time goes past
midnight.

e.g start 19:50 end 00:20 should = 4:30 except i just get an endless
series of #######

Thanks for your time.

Ian



  #5  
Old May 6th, 2010, 12:32 PM posted to microsoft.public.excel.worksheet.functions
Bob Phillips[_3_]
external usenet poster
 
Posts: 489
Default Time calculations over 24hrs

Use

=MOD(B1-A1,1)

--

HTH

Bob

"Ian R" wrote in message
m...
Hi

I'm using Excel 2003.

I'm trying to calculate the total hours (C1) by subtracting end time
(B1) from start time (A1)

I have formatted the cells for time.

I'm currently using B1-A1 which works OK until the end time goes past
midnight.

e.g start 19:50 end 00:20 should = 4:30 except i just get an endless
series of #######

Thanks for your time.

Ian



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.