#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default number to time

Help
I have 2 columns both with 4 digits as a time 1341 1415 . thease
fields are brought in from another system and can not be changed to a time
format what i am trying to do is work out the difference if it takes away
1341 from 1415 as a time rather than a number, so i get 34 as the result
instead of 74 as i get at present.

Thank you in advance for help

Stan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default number to time

If you have always got four digits, then you can convert each into a
time with the following:

=VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00"), and
=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")

Format them as Time. So, if you just want the difference in minutes
then:

=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")-
VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00")

and format as [mm]:ss (assumes B1 is a later time than A1).

Hope this helps.

Pete

On May 3, 4:25 pm, Stan Halls
wrote:
Help
I have 2 columns both with 4 digits as a time 1341 1415 . thease
fields are brought in from another system and can not be changed to a time
format what i am trying to do is work out the difference if it takes away
1341 from 1415 as a time rather than a number, so i get 34 as the result
instead of 74 as i get at present.

Thank you in advance for help

Stan



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default number to time

Appoliges for this ,,,, that worked great but..... i did not realise that if
the time was before 1000 it droped to a 3 digit number ie 0936 shows as 936 ,
any ideas how to add this to the below ?


"Pete_UK" wrote:

If you have always got four digits, then you can convert each into a
time with the following:

=VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00"), and
=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")

Format them as Time. So, if you just want the difference in minutes
then:

=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")-
VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00")

and format as [mm]:ss (assumes B1 is a later time than A1).

Hope this helps.

Pete

On May 3, 4:25 pm, Stan Halls
wrote:
Help
I have 2 columns both with 4 digits as a time 1341 1415 . thease
fields are brought in from another system and can not be changed to a time
format what i am trying to do is work out the difference if it takes away
1341 from 1415 as a time rather than a number, so i get 34 as the result
instead of 74 as i get at present.

Thank you in advance for help

Stan




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default number to time

sorted, i reset to page format to make it show 4 didgets

Thank you for your help

"Stan Halls" wrote:

Appoliges for this ,,,, that worked great but..... i did not realise that if
the time was before 1000 it droped to a 3 digit number ie 0936 shows as 936 ,
any ideas how to add this to the below ?


"Pete_UK" wrote:

If you have always got four digits, then you can convert each into a
time with the following:

=VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00"), and
=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")

Format them as Time. So, if you just want the difference in minutes
then:

=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")-
VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00")

and format as [mm]:ss (assumes B1 is a later time than A1).

Hope this helps.

Pete

On May 3, 4:25 pm, Stan Halls
wrote:
Help
I have 2 columns both with 4 digits as a time 1341 1415 . thease
fields are brought in from another system and can not be changed to a time
format what i am trying to do is work out the difference if it takes away
1341 from 1415 as a time rather than a number, so i get 34 as the result
instead of 74 as i get at present.

Thank you in advance for help

Stan




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default number to time

nope spoke to soon

"Stan Halls" wrote:

sorted, i reset to page format to make it show 4 didgets

Thank you for your help

"Stan Halls" wrote:

Appoliges for this ,,,, that worked great but..... i did not realise that if
the time was before 1000 it droped to a 3 digit number ie 0936 shows as 936 ,
any ideas how to add this to the below ?


"Pete_UK" wrote:

If you have always got four digits, then you can convert each into a
time with the following:

=VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00"), and
=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")

Format them as Time. So, if you just want the difference in minutes
then:

=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")-
VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00")

and format as [mm]:ss (assumes B1 is a later time than A1).

Hope this helps.

Pete

On May 3, 4:25 pm, Stan Halls
wrote:
Help
I have 2 columns both with 4 digits as a time 1341 1415 . thease
fields are brought in from another system and can not be changed to a time
format what i am trying to do is work out the difference if it takes away
1341 from 1415 as a time rather than a number, so i get 34 as the result
instead of 74 as i get at present.

Thank you in advance for help

Stan





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default number to time

Okay, you can change it to the following to cope with 3 or 4 digit
times in either or both A1 and B1:

=IF(LEN(B1)=3,VALUE(LEFT(B1,1)&":"&RIGHT(B1,2)&":
00"),VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00"))-
IF(LEN(A1)=3,VALUE(LEFT(A1,1)&":"&RIGHT(B1,2)&":
00"),VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00"))

I've assumed that only leading zeroes in the hour will be suppressed,
so that 903 represents 9:03, but 1003 would be used for 10:03.

Hope this helps.

Pete

On May 3, 9:36 pm, Stan Halls
wrote:
nope spoke to soon



"Stan Halls" wrote:
sorted, i reset to page format to make it show 4 didgets


Thank you for your help


"Stan Halls" wrote:


Appoliges for this ,,,, that worked great but..... i did not realise that if
the time was before 1000 it droped to a 3 digit number ie 0936 shows as 936 ,
any ideas how to add this to the below ?


"Pete_UK" wrote:


If you have always got four digits, then you can convert each into a
time with the following:


=VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00"), and
=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")


Format them as Time. So, if you just want the difference in minutes
then:


=VALUE(LEFT(B1,2)&":"&RIGHT(B1,2)&":00")-
VALUE(LEFT(A1,2)&":"&RIGHT(A1,2)&":00")


and format as [mm]:ss (assumes B1 is a later time than A1).


Hope this helps.


Pete


On May 3, 4:25 pm, Stan Halls
wrote:
Help
I have 2 columns both with 4 digits as a time 1341 1415 . thease
fields are brought in from another system and can not be changed to a time
format what i am trying to do is work out the difference if it takes away
1341 from 1415 as a time rather than a number, so i get 34 as the result
instead of 74 as i get at present.


Thank you in advance for help


Stan- Hide quoted text -


- Show quoted text -



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default number to time

=1440*(TIME(LEFT(B1,2),RIGHT(B1,2),0)-TIME(LEFT(A1,2),RIGHT(A1,2),0))
--
David Biddulph

"Stan Halls" wrote in message
...
Help
I have 2 columns both with 4 digits as a time 1341 1415 . thease
fields are brought in from another system and can not be changed to a time
format what i am trying to do is work out the difference if it takes away
1341 from 1415 as a time rather than a number, so i get 34 as the result
instead of 74 as i get at present.

Thank you in advance for help

Stan



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
time into a number Polochilde Excel Discussion (Misc queries) 6 March 5th 07 04:12 AM
Every time i put a number with period it becomes a date and time excelSOS Excel Discussion (Misc queries) 7 March 7th 06 12:20 AM
Formula Help - Number to Time Mark Broom Setting up and Configuration of Excel 1 January 7th 06 05:35 AM
Time as number Howard Excel Discussion (Misc queries) 4 June 23rd 05 09:12 PM
Time to number Steved Excel Worksheet Functions 3 April 27th 05 08:00 AM


All times are GMT +1. The time now is 11:41 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"