Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Formula to convert a time duration into hours?

Hello!


In Numbers, is there a way to use a formula to convert time durations such as "7:30-1:45" into a decimal for hours (i.e. "6.25")?


I have been writing in the time frames that I am scheduled to work and would like to have a total at the end of each week in a column that converts the given time frames into the amount of hours I worked that week.


Is there any way to achieve this?


I have tried the "TIMEVALUE" option, as I feel that is the best option I could find, but it seems to only allow input of one specific hour.


Thank you for your time.

Posted on Apr 24, 2015 10:24 AM

Question marked as Best reply

Posted on Apr 24, 2015 1:50 PM

Maybe something like this would work for you:


User uploaded file


I assume your "7:30-01:45" is just Text in a cell. It is not a true Numbers 'Duration' data format.


You can split it into two separate strings that Numbers can interpret as times, then take the TIMEVALUE of each time, and derive the difference expressed in decimal hours.


The formula in B2 to extract the first time from the text:


=LEFT(A2,FIND("-",A2,1)−1)


The formula in C2 to extract the second time from the text:


=RIGHT(A2,LEN(A2)−FIND("-",A2,1))


The formula in D2:


=TIMEVALUE(B2)


The formula in E2:


=TIMEVALUE(C2)


The formula in F2:


=(E2−D2) x 24


You could combine some of the formulas to reduce the number of columns.


I used a 24-hour notation but am/pm also works if there are no spaces as shown:


User uploaded file


SG

2 replies
Question marked as Best reply

Apr 24, 2015 1:50 PM in response to Community User

Maybe something like this would work for you:


User uploaded file


I assume your "7:30-01:45" is just Text in a cell. It is not a true Numbers 'Duration' data format.


You can split it into two separate strings that Numbers can interpret as times, then take the TIMEVALUE of each time, and derive the difference expressed in decimal hours.


The formula in B2 to extract the first time from the text:


=LEFT(A2,FIND("-",A2,1)−1)


The formula in C2 to extract the second time from the text:


=RIGHT(A2,LEN(A2)−FIND("-",A2,1))


The formula in D2:


=TIMEVALUE(B2)


The formula in E2:


=TIMEVALUE(C2)


The formula in F2:


=(E2−D2) x 24


You could combine some of the formulas to reduce the number of columns.


I used a 24-hour notation but am/pm also works if there are no spaces as shown:


User uploaded file


SG

Formula to convert a time duration into hours?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.