Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert time to a number

6 views
Skip to first unread message

hollywood

unread,
Aug 28, 2009, 8:41:03 AM8/28/09
to
Please note that I am a novice to excel, so please reply in a manner that I
will understand. My problem is, I would like to convert time to a number that
I can use in a simple program I have created with excel. At present I am
copying from a PDF format and pasting to excel. The following time is what I
am copying and pasting (2:05) where the 2 = minutes and the 5 = seconds,
There is also fifth of a seconds involved at times, but is not critical for
the application, so it could be left out of the solution if necessary. At
present I am converting the time manually, 2:05 = 125, etc. with each time
that is posted. This becomes very time consuming. If there is a solution to
my problem it would cut my posting time in halve. If there is a solution, do
I post the time in cell A1 and the function in cell B1.

Gary''s Student

unread,
Aug 28, 2009, 8:50:01 AM8/28/09
to
=86400*A1 and format the cell as Number
--
Gary''s Student - gsnu200902

Sean Timmons

unread,
Aug 28, 2009, 12:28:01 PM8/28/09
to
And the below would be entered into B1.

Please note, Excel treats a day as 1. So, an hour is 1/24, a minute is
1/1440 and a second is 1/86400.

Pete_UK

unread,
Aug 28, 2009, 12:39:26 PM8/28/09
to
You need to be a bit careful with this. Although you might interpret
2:05 as meaning 2 minutes and 5 seconds, if that is copied into Excel
it might treat it as a text value, or as a time showing h:mm. Click on
Format | Cells | Number tab and see what format is applied to the
cell. If it is a time with h:mm format then you will need to use 1440
rather than 86400 as the multiplier in the solutions given.

If the format shows Text or General, then you could use this formula:

=VALUE("0:"&A1)*24*60*60

(I prefer to use the individual multipliers)

Hope this helps.

Pete

On Aug 28, 1:41 pm, hollywood <hollyw...@discussions.microsoft.com>
wrote:

hollywood

unread,
Aug 29, 2009, 10:35:01 AM8/29/09
to
When I use =86400*A1 I get 7500.00 formatted as a number. When I use 1400 I
get 121.5 Getting close but it does not =125 when 2 minutes 5 seconds is
converted manually to seconds. The A1 cell is shown formatted as "time" H:MM
I thank you all for your efforts. I guess I just have to change it manually.
Any other ideas would be appreciated

barry houdini

unread,
Aug 29, 2009, 10:44:10 AM8/29/09
to

You need to multiply by *1440* (the number of minutes in a day) not
1400


--
barry houdini
------------------------------------------------------------------------
barry houdini's Profile: http://www.thecodecage.com/forumz/member.php?userid=72
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=129426

JoeU2004

unread,
Aug 29, 2009, 10:51:31 AM8/29/09
to
"hollywood" <holl...@discussions.microsoft.com> wrote:
> When I use 1400 I get 121.5 Getting close but it does not =125 when
> 2 minutes 5 seconds is converted manually to seconds. The A1 cell is
> shown formatted as "time" H:MM

That's because the correct multiplier is 1440, not 1400. 1440 is 24*60
because there 24 hours in a day and 60 minutes in an hour.

But it would be prudent to round the result. The following should work
reliably:

=ROUND(A1*1440, 0)


----- original message -----

"hollywood" <holl...@discussions.microsoft.com> wrote in message
news:D8D25CA2-E268-4667...@microsoft.com...

JP Ronse

unread,
Aug 29, 2009, 10:59:11 AM8/29/09
to
Hi Hollywood,

You have in A1 00:02:05, correct? Try in B1: =A1.

You will first have the same value in B1. Now, format, cells, custom: [ss]

This gives 125.

You can of course format column A directly in the same way.

Wkr,

JP


"hollywood" <holl...@discussions.microsoft.com> wrote in message
news:D8D25CA2-E268-4667...@microsoft.com...

JoeU2004

unread,
Aug 29, 2009, 11:50:10 AM8/29/09
to
"JP Ronse" <fb89...@skynet.be> wrote:
> You have in A1 00:02:05, correct? Try in B1: =A1.
> [....] Now, format, cells, custom: [ss]
> This gives 125.

Let's not confuse things. The fact that A1*1400 [sic] gives almost the
right answer should tell you that, no, he does not have 00:02:05 in the
cell.

Moreover, formatting only changes the appearance of a number. In this case,
it does not change the fact that the number 02:05 is a decimal fraction.

First, as Hollywood explains at the outset: "I am copying from a PDF format

and pasting to excel. The following time is what I am copying and pasting

(2:05) where the 2 = minutes and the 5 = seconds".

So he is entering time as xx:yy. He wants to interpret that as mm:ss. But
Excel interprets any number of the form xx:yy as hh:mm, even if we preformat
the cell as mm:ss.

That is why he must use A1*1440 instead of A1*86400. He really has minutes
as a decimal fraction, not seconds. That is, when he entered 2:05, he
effectively entered 2 hr 5 min instead of 2 min 5 sec.

(Aside.... I just discovered that if he entered 2:05.0, Excel would
interpret that as mm:ss.0, even if we preformat the cell as hh:mm. But I
digress....)

Second, as Hollywood explains at the outset: "I would like to convert time
to a number [...]. At present I am converting the time manually, 2:05 =
125".

So he wants integer seconds, not a decimal fraction. That is why a simple
format change is not sufficient.


----- original message -----

"JP Ronse" <fb89...@skynet.be> wrote in message
news:OhHqGlLK...@TK2MSFTNGP04.phx.gbl...

JoeU2004

unread,
Aug 29, 2009, 1:57:52 PM8/29/09
to
Errata....

I wrote:


> "JP Ronse" <fb89...@skynet.be> wrote:
>> Now, format, cells, custom: [ss]
>> This gives 125.

> [....]


> So he wants integer seconds, not a decimal fraction.
> That is why a simple format change is not sufficient.

Well, that's not so obvious; sorry for being so dismissive.

Perhaps the custom format "[m]" (without quotes) would indeed satisfy
Hollywood's requirements. That's for him to decide. Bear in mind that the
time is actually a decimal fraction, despite appearances.


----- original message -----

"JoeU2004" <joeu...@hotmail.com> wrote in message
news:untDkBMK...@TK2MSFTNGP02.phx.gbl...

0 new messages