Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Convert data entry to mins:secs

Hi,

Would someone be kind enough to assist with code to automatically
convert:

data entry 1234 to 12:34 (12 mins:34 secs)

Thanks in advance

Bob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Convert data entry to mins:secs

Hi Bob,

Assuming that cell A2 contains 1234 then
=TIMEVALUE("00:"&LEFT(TEXT(A1,"0000"),2)&":"&RIGHT (TEXT(A1,"0000"),2))

Custom format the cell containing the formula to the following
[mm]" mins":ss" secs"

The square brackets stops minute value 60 or greater becoming hours. For
example 6429 becomes 69 mins:29 secs. Up to you whether you use them but if
not then any values 60 or greater minutes will need format to include hours.

Using TEXT to format to 4 digits ensures that it works with say 142 to become
1 mins:42 secs.

The "00" at the leading end is dummy hours otherwise Excel thinks that it is
hrs and mins rather than mins and secs.


--
Regards,

OssieMac


"Ozbobeee" wrote:

Hi,

Would someone be kind enough to assist with code to automatically
convert:

data entry 1234 to 12:34 (12 mins:34 secs)

Thanks in advance

Bob

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Convert data entry to mins:secs

You can use this formula instead of the one you posted...

=--TEXT(A1,"00\:00\:00")

still using the same Custom Format you indicated.

--
Rick (MVP - Excel)


"OssieMac" wrote in message
...
Hi Bob,

Assuming that cell A2 contains 1234 then
=TIMEVALUE("00:"&LEFT(TEXT(A1,"0000"),2)&":"&RIGHT (TEXT(A1,"0000"),2))

Custom format the cell containing the formula to the following
[mm]" mins":ss" secs"

The square brackets stops minute value 60 or greater becoming hours. For
example 6429 becomes 69 mins:29 secs. Up to you whether you use them but
if
not then any values 60 or greater minutes will need format to include
hours.

Using TEXT to format to 4 digits ensures that it works with say 142 to
become
1 mins:42 secs.

The "00" at the leading end is dummy hours otherwise Excel thinks that it
is
hrs and mins rather than mins and secs.


--
Regards,

OssieMac


"Ozbobeee" wrote:

Hi,

Would someone be kind enough to assist with code to automatically
convert:

data entry 1234 to 12:34 (12 mins:34 secs)

Thanks in advance

Bob


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Convert data entry to mins:secs

On Oct 24, 5:14*pm, "Rick Rothstein"
wrote:
You can use this formula instead of the one you posted...

=--TEXT(A1,"00\:00\:00")

still using the same Custom Format you indicated.

--
Rick (MVP - Excel)

"OssieMac" wrote in message

...

Hi Bob,


Assuming that cell A2 contains 1234 then
=TIMEVALUE("00:"&LEFT(TEXT(A1,"0000"),2)&":"&RIGHT (TEXT(A1,"0000"),2))


Custom format the cell containing the formula to the following
[mm]" mins":ss" secs"


The square brackets stops minute value 60 or greater becoming hours. For
example 6429 becomes 69 mins:29 secs. Up to you whether you use them but
if
not then any values 60 or greater minutes will need format to include
hours.


Using TEXT to format to 4 digits ensures that it works with say 142 to
become
1 mins:42 secs.


The "00" at the leading end is dummy hours otherwise Excel thinks that it
is
hrs and mins rather than mins and secs.


--
Regards,


OssieMac


"Ozbobeee" wrote:


Hi,


Would someone be kind enough to assist with code to automatically
convert:


data entry 1234 to 12:34 (12 mins:34 secs)


Thanks in advance


Bob


Thanks Fellas.

Cheers

Bob
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Convert data entry to mins:secs

Since you posted in programming here is a programming solution to convert the
number to time...

http://www.cpearson.com/excel/DateTimeEntry.htm
--
HTH...

Jim Thomlinson


"Ozbobeee" wrote:

Hi,

Would someone be kind enough to assist with code to automatically
convert:

data entry 1234 to 12:34 (12 mins:34 secs)

Thanks in advance

Bob



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Convert data entry to mins:secs

Hi Rick,

I really like your answer. However, my curiosity is never satisfied unless I
understand all the why's and wherefores. I Googled it trying to find more
info on your method and whether similar approach applies to any other
formatting but without success. I wonder if you can point me towards some
documentation to explain it please.

--
Regards,

OssieMac


"Rick Rothstein" wrote:

You can use this formula instead of the one you posted...

=--TEXT(A1,"00\:00\:00")

still using the same Custom Format you indicated.

--
Rick (MVP - Excel)


"OssieMac" wrote in message
...
Hi Bob,

Assuming that cell A2 contains 1234 then
=TIMEVALUE("00:"&LEFT(TEXT(A1,"0000"),2)&":"&RIGHT (TEXT(A1,"0000"),2))

Custom format the cell containing the formula to the following
[mm]" mins":ss" secs"

The square brackets stops minute value 60 or greater becoming hours. For
example 6429 becomes 69 mins:29 secs. Up to you whether you use them but
if
not then any values 60 or greater minutes will need format to include
hours.

Using TEXT to format to 4 digits ensures that it works with say 142 to
become
1 mins:42 secs.

The "00" at the leading end is dummy hours otherwise Excel thinks that it
is
hrs and mins rather than mins and secs.


--
Regards,

OssieMac


"Ozbobeee" wrote:

Hi,

Would someone be kind enough to assist with code to automatically
convert:

data entry 1234 to 12:34 (12 mins:34 secs)

Thanks in advance

Bob



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Convert data entry to mins:secs

I'm not aware of any documents that will explain it. Basically, the TEXT
function will distribute the digits in the integer portion of the number (in
case a floating point value is specified for the first argument),
right-justified, into the 0 or # (in front of the decimal point if there is
one) provided in the format pattern. We need to escape the colons (that is
what the back slash does, makes the colons pure text instead of them having
their special meaning to the TEXT function as time separators) in order to
be able to create a text string value that "looks" like a time value... the
double unary symbols in front of the TEXT function tells Excel to try and
make the text string into a numeric value if possible. Excel is very
versatile in making text strings into numbers and, in this case, it sees a
text string that looks like a time value, so it makes it into a time value.

--
Rick (MVP - Excel)


"OssieMac" wrote in message
...
Hi Rick,

I really like your answer. However, my curiosity is never satisfied unless
I
understand all the why's and wherefores. I Googled it trying to find more
info on your method and whether similar approach applies to any other
formatting but without success. I wonder if you can point me towards some
documentation to explain it please.

--
Regards,

OssieMac


"Rick Rothstein" wrote:

You can use this formula instead of the one you posted...

=--TEXT(A1,"00\:00\:00")

still using the same Custom Format you indicated.

--
Rick (MVP - Excel)


"OssieMac" wrote in message
...
Hi Bob,

Assuming that cell A2 contains 1234 then
=TIMEVALUE("00:"&LEFT(TEXT(A1,"0000"),2)&":"&RIGHT (TEXT(A1,"0000"),2))

Custom format the cell containing the formula to the following
[mm]" mins":ss" secs"

The square brackets stops minute value 60 or greater becoming hours.
For
example 6429 becomes 69 mins:29 secs. Up to you whether you use them
but
if
not then any values 60 or greater minutes will need format to include
hours.

Using TEXT to format to 4 digits ensures that it works with say 142 to
become
1 mins:42 secs.

The "00" at the leading end is dummy hours otherwise Excel thinks that
it
is
hrs and mins rather than mins and secs.


--
Regards,

OssieMac


"Ozbobeee" wrote:

Hi,

Would someone be kind enough to assist with code to automatically
convert:

data entry 1234 to 12:34 (12 mins:34 secs)

Thanks in advance

Bob




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
How to sum hours, mins, secs (00:00:00)? Dave Excel Discussion (Misc queries) 8 June 4th 09 01:36 PM
Format Cells for Mins / Secs Chris Cornell Excel Worksheet Functions 2 June 3rd 07 05:56 AM
how can i convert a value quoted in hrs,mins,secs to just mins The man from delmonte Excel Worksheet Functions 1 October 17th 06 11:12 AM
Importing Mins:Secs Terry Pinnell Excel Discussion (Misc queries) 3 October 11th 06 06:54 PM
Convert mins:secs to seconds only ronedwards Excel Worksheet Functions 3 November 3rd 05 11:10 PM


All times are GMT +1. The time now is 04:51 PM.

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

About Us

"It's about Microsoft Excel"