decimal time data entry

A

astrodog

is there a built in format ...or one i can input that will convert
'normal' time format into decimal time?

example: end user will enter 2:36:20 (two hours, 36 minutes, 20
seconds) into a cell -
it needs to be converted to 2.6 (2.6 hrs) when they leave it.

I have written some vba code (triggered by Worksheet_Change event)
that does this..but after learning more about how the xls file is used
I do not want to have to modify the code to deal with the new 'scope'.

Thanks.
 
B

Benito Merino

is there a built in format ...or one i can input that will convert
'normal' time format into decimal time?

example:  end user will enter 2:36:20  (two hours, 36 minutes, 20
seconds) into a cell -
it needs to be converted to 2.6 (2.6 hrs) when they leave it.

I have written some vba code (triggered by Worksheet_Change event)
that does this..but after learning more about how the xls file is used
I do not want to have to modify the code to deal with the new 'scope'.

Thanks.

Hello astrodog.

for instance: =A2/timevalue("1:00")

Regards,

Benito
Barcelona
 
R

Ron Rosenfeld

is there a built in format ...or one i can input that will convert
'normal' time format into decimal time?

example: end user will enter 2:36:20 (two hours, 36 minutes, 20
seconds) into a cell -
it needs to be converted to 2.6 (2.6 hrs) when they leave it.

I have written some vba code (triggered by Worksheet_Change event)
that does this..but after learning more about how the xls file is used
I do not want to have to modify the code to deal with the new 'scope'.

Thanks.

There is no format that will do that.

When you input a time, Excel stores this as a fraction of a day. So to convert
it to decimal time, you would need to multiply the contents of the cell by 24,
and then format it as General or Number (with the required number of decimal
places).

You would need to do this either in VBA; or by inputting in one cell (or user
form or input box), but displaying a different cell that has the formula in it.
--ron
 
F

FrankWood

You could do it with a formula based on the data entry. Something like this:
=HOUR(G2)&TEXT(MINUTE(G2)/60,".##")

Assuming G2 has the entry "2:36:20" this formula will return "2.6".

Hope that helps.

Frank
 
A

astrodog

There is no format that will do that.

When you input a time, Excel stores this as a fraction of a day.  So toconvert
it to decimal time, you would need to multiply the contents of the cell by 24,
and then format it as General or Number (with the required number of decimal
places).

You would need to do this either in VBA; or by inputting in one cell (or user
form or input box), but displaying a different cell that has the formula in it.
--ron

ok - not want i wanted to hear -- but at least i'll avoid the time
running down the wrong path.

Thanks )
 
R

Ron Rosenfeld

ok - not want i wanted to hear -- but at least i'll avoid the time
running down the wrong path.

Thanks )

At least I saved you some time :-( Wish there were a better answer.
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top