A Microsoft Excel forum. ExcelBanter

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 » ExcelBanter forum » Excel Newsgroups » Excel Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Adding and Subtracting a Time with MilliSeconds



 
 
Thread Tools Display Modes
  #1  
Old May 31st 07, 04:20 PM posted to microsoft.public.excel.worksheet.functions
Carl
external usenet poster
 
Posts: 361
Default Adding and Subtracting a Time with MilliSeconds

My time comes in like this:

10:39:41:91
10:39:54.01

hours:minutes:seconds.milliseconds.

Is there a way to add and subtract times in this format ?

Thank you in advance.
Ads
  #2  
Old May 31st 07, 04:33 PM posted to microsoft.public.excel.worksheet.functions
JE McGimpsey
external usenet poster
 
Posts: 4,624
Default Adding and Subtracting a Time with MilliSeconds

Hmmm... you give two different formats.

If they come in as milliseconds:

10:39:41.001

(.01 would be centiseconds, and :01 is something else entirely), then

A1: 10:39:41.91 (or 10:39:41.910)
A2: 10:39:54.01 (or 10:39:54.010)

use

A3: = A2 - A1

and format A3 with Format/Cells/Number/Custom hh:mm:ss.00 (hh:mm:ss.000)





In article >,
carl > wrote:

> My time comes in like this:
>
> 10:39:41:91
> 10:39:54.01
>
> hours:minutes:seconds.milliseconds.
>
> Is there a way to add and subtract times in this format ?
>
> Thank you in advance.

  #3  
Old May 31st 07, 04:45 PM posted to microsoft.public.excel.worksheet.functions
David Biddulph[_2_]
external usenet poster
 
Posts: 8,651
Default Adding and Subtracting a Time with MilliSeconds

They look to me like centiseconds rather than milliseconds.

If you correct the first one where you've mistyped a colon instead of the
decimal point, then you can add as normal.
=A1+A2 will give you the answer.
If the answer may go beyond 24 hours, custom format something like
[h]:mm:ss.00
--
David Biddulph

"carl" > wrote in message
...
> My time comes in like this:
>
> 10:39:41:91
> 10:39:54.01
>
> hours:minutes:seconds.milliseconds.
>
> Is there a way to add and subtract times in this format ?
>
> Thank you in advance.



  #4  
Old May 31st 07, 04:47 PM posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
external usenet poster
 
Posts: 3,268
Default Adding and Subtracting a Time with MilliSeconds

That would be text for Excel, the custom format that would include
milliseconds in Excel is

hh:mm:ss.000

it's a period not a colon so you would need to convert them

=--SUBSTITUTE(A1,":",".0",3)


formatted as above would work for you examples but if you would have

10:39:55:211

then this might work

=IF(LEN(MID(A1,FIND(".",SUBSTITUTE(A1,":",".",3))+ 1,255))=3,--SUBSTITUTE(A1,":",".",3),--SUBSTITUTE(A1,":",".0",3))


remember to format as

hh:mm:ss.000


--
Regards,

Peo Sjoblom



"carl" > wrote in message
...
> My time comes in like this:
>
> 10:39:41:91
> 10:39:54.01
>
> hours:minutes:seconds.milliseconds.
>
> Is there a way to add and subtract times in this format ?
>
> Thank you in advance.



  #5  
Old May 31st 07, 04:53 PM posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
external usenet poster
 
Posts: 3,268
Default Adding and Subtracting a Time with MilliSeconds

Doh! Forget it, I thought you had 3 colons there


--
Regards,

Peo Sjoblom



"Peo Sjoblom" > wrote in message
...
> That would be text for Excel, the custom format that would include
> milliseconds in Excel is
>
> hh:mm:ss.000
>
> it's a period not a colon so you would need to convert them
>
> =--SUBSTITUTE(A1,":",".0",3)
>
>
> formatted as above would work for you examples but if you would have
>
> 10:39:55:211
>
> then this might work
>
> =IF(LEN(MID(A1,FIND(".",SUBSTITUTE(A1,":",".",3))+ 1,255))=3,--SUBSTITUTE(A1,":",".",3),--SUBSTITUTE(A1,":",".0",3))
>
>
> remember to format as
>
> hh:mm:ss.000
>
>
> --
> Regards,
>
> Peo Sjoblom
>
>
>
> "carl" > wrote in message
> ...
>> My time comes in like this:
>>
>> 10:39:41:91
>> 10:39:54.01
>>
>> hours:minutes:seconds.milliseconds.
>>
>> Is there a way to add and subtract times in this format ?
>>
>> Thank you in advance.

>
>



  #6  
Old May 31st 07, 07:09 PM posted to microsoft.public.excel.worksheet.functions
Erny
external usenet poster
 
Posts: 12
Default Adding and Subtracting a Time with MilliSeconds

Hmmm, if you wish to be able to add this in a way that you use mixed
separation symbols (as in your example for the "milliseconds" - i'd call it
rather hundreth of seconds) and still have a result displaying hours minutes
seconds and hundreths of seconds, you could use of course (for an addition
for example) a formula such as:

=TEXT(VALUE(LEFT(A1,2))+VALUE(LEFT(A2,2))+((VALUE( MID(A1,4,2))+VALUE(MID(A2,4,2))+((VALUE(MID(A1,7,2 ))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2))+VALUE(R IGHT(A2,2)))>99)>59)>59),"#0")&":"&TEXT(MOD(VALUE( MID(A1,4,2))+VALUE(MID(A2,4,2))+((VALUE(MID(A1,7,2 ))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2))+VALUE(R IGHT(A2,2)))>99)>59),60),"00")&":"&TEXT(MOD(VALUE( MID(A1,7,2))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2 ))+VALUE(RIGHT(A2,2)))>99),60),"00")&":"&TEXT(MOD( VALUE(RIGHT(A1,2))+VALUE(RIGHT(A2,2)),100),"00")

This should work, but I'm sure there's other ways...:-) I'm just too lazy to
think today, and of course you would find a similar approach for
subtraction...
(hope I haven't missed a parenthesis somewhere - no means to test today)

Have fun,
Erny

"carl" > schrieb im Newsbeitrag
...
> My time comes in like this:
>
> 10:39:41:91
> 10:39:54.01
>
> hours:minutes:seconds.milliseconds.
>
> Is there a way to add and subtract times in this format ?
>
> Thank you in advance.



  #7  
Old May 31st 07, 07:44 PM posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
external usenet poster
 
Posts: 3,268
Default Adding and Subtracting a Time with MilliSeconds

You can leave out all the VALUE functions if you do calculations with them

=VALUE(LEFT(A1,2))+VALUE(RIGHT(A1,2))

is no different than

=LEFT(A1,2)+RIGHT(A1,2)

when it comes to the result, the calculation will force the text to number


also the value function is really totally obsolete except for pedagogical
reasons
same goes for datevalue and timevalue




--
Regards,

Peo Sjoblom




"Erny" > wrote in message
...
> Hmmm, if you wish to be able to add this in a way that you use mixed
> separation symbols (as in your example for the "milliseconds" - i'd call
> it rather hundreth of seconds) and still have a result displaying hours
> minutes seconds and hundreths of seconds, you could use of course (for an
> addition for example) a formula such as:
>
> =TEXT(VALUE(LEFT(A1,2))+VALUE(LEFT(A2,2))+((VALUE( MID(A1,4,2))+VALUE(MID(A2,4,2))+((VALUE(MID(A1,7,2 ))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2))+VALUE(R IGHT(A2,2)))>99)>59)>59),"#0")&":"&TEXT(MOD(VALUE( MID(A1,4,2))+VALUE(MID(A2,4,2))+((VALUE(MID(A1,7,2 ))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2))+VALUE(R IGHT(A2,2)))>99)>59),60),"00")&":"&TEXT(MOD(VALUE( MID(A1,7,2))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2 ))+VALUE(RIGHT(A2,2)))>99),60),"00")&":"&TEXT(MOD( VALUE(RIGHT(A1,2))+VALUE(RIGHT(A2,2)),100),"00")
>
> This should work, but I'm sure there's other ways...:-) I'm just too lazy
> to think today, and of course you would find a similar approach for
> subtraction...
> (hope I haven't missed a parenthesis somewhere - no means to test today)
>
> Have fun,
> Erny
>
> "carl" > schrieb im Newsbeitrag
> ...
>> My time comes in like this:
>>
>> 10:39:41:91
>> 10:39:54.01
>>
>> hours:minutes:seconds.milliseconds.
>>
>> Is there a way to add and subtract times in this format ?
>>
>> Thank you in advance.

>
>



  #8  
Old May 31st 07, 10:55 PM posted to microsoft.public.excel.worksheet.functions
Erny
external usenet poster
 
Posts: 12
Default Adding and Subtracting a Time with MilliSeconds

Thx for the reminder, was a bit tired today...:-)

"Peo Sjoblom" > schrieb im Newsbeitrag
...
> You can leave out all the VALUE functions if you do calculations with them
>
> =VALUE(LEFT(A1,2))+VALUE(RIGHT(A1,2))
>
> is no different than
>
> =LEFT(A1,2)+RIGHT(A1,2)
>
> when it comes to the result, the calculation will force the text to number
>
>
> also the value function is really totally obsolete except for pedagogical
> reasons
> same goes for datevalue and timevalue
>
>
>
>
> --
> Regards,
>
> Peo Sjoblom
>
>
>
>
> "Erny" > wrote in message
> ...
>> Hmmm, if you wish to be able to add this in a way that you use mixed
>> separation symbols (as in your example for the "milliseconds" - i'd call
>> it rather hundreth of seconds) and still have a result displaying hours
>> minutes seconds and hundreths of seconds, you could use of course (for an
>> addition for example) a formula such as:
>>
>> =TEXT(VALUE(LEFT(A1,2))+VALUE(LEFT(A2,2))+((VALUE( MID(A1,4,2))+VALUE(MID(A2,4,2))+((VALUE(MID(A1,7,2 ))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2))+VALUE(R IGHT(A2,2)))>99)>59)>59),"#0")&":"&TEXT(MOD(VALUE( MID(A1,4,2))+VALUE(MID(A2,4,2))+((VALUE(MID(A1,7,2 ))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2))+VALUE(R IGHT(A2,2)))>99)>59),60),"00")&":"&TEXT(MOD(VALUE( MID(A1,7,2))+VALUE(MID(A2,7,2))+((VALUE(RIGHT(A1,2 ))+VALUE(RIGHT(A2,2)))>99),60),"00")&":"&TEXT(MOD( VALUE(RIGHT(A1,2))+VALUE(RIGHT(A2,2)),100),"00")
>>
>> This should work, but I'm sure there's other ways...:-) I'm just too lazy
>> to think today, and of course you would find a similar approach for
>> subtraction...
>> (hope I haven't missed a parenthesis somewhere - no means to test today)
>>
>> Have fun,
>> Erny
>>
>> "carl" > schrieb im Newsbeitrag
>> ...
>>> My time comes in like this:
>>>
>>> 10:39:41:91
>>> 10:39:54.01
>>>
>>> hours:minutes:seconds.milliseconds.
>>>
>>> Is there a way to add and subtract times in this format ?
>>>
>>> Thank you in advance.

>>
>>

>
>



 




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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding and subtracting time Terry Bennett Excel Worksheet Functions 2 February 13th 07 12:24 PM
Comparing time values which have milliseconds in them e.g 10:20:30 Jon Stickings Excel Discussion (Misc queries) 5 October 5th 06 02:03 PM
Adding/Subtracting Time Help... killertofu Excel Worksheet Functions 3 February 15th 06 08:49 PM
adding/subtracting time [email protected] Excel Worksheet Functions 5 January 11th 06 02:43 PM
Adding Subtracting Time Formula-Horse Racing SMDIYDLI Excel Discussion (Misc queries) 1 December 13th 04 09:27 PM


All times are GMT +1. The time now is 12:30 AM.


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