#1   Report Post  
Steven
 
Posts: n/a
Default Hour() function

I am calculating overtime and have a time of 25:28. That is 25 hours and 28
minutes. It is formatted Custom [h]:mm so you actually see the 25:28 in the
cell. I want to pull the hours into a sererate cell as 25 in this case. I
keep getting a 1 and if I try to add this hour and another number it gives me
another confusing answer.

My question is how do I return the hours (25 in this case) to its own cell
and have it actually be a value of 25.

Thank you for your help.

Steven
  #2   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

One way

=INT(A1*24)

assuming the 25:28 is in A1

Regards,

Peo Sjoblom


"Steven" wrote in message
...
I am calculating overtime and have a time of 25:28. That is 25 hours and

28
minutes. It is formatted Custom [h]:mm so you actually see the 25:28 in

the
cell. I want to pull the hours into a sererate cell as 25 in this case.

I
keep getting a 1 and if I try to add this hour and another number it gives

me
another confusing answer.

My question is how do I return the hours (25 in this case) to its own cell
and have it actually be a value of 25.

Thank you for your help.

Steven



  #3   Report Post  
Steven
 
Posts: n/a
Default


Nice job Peo. Thanks.
  #4   Report Post  
Sloth
 
Posts: n/a
Default

I know the question has been answered already, but I thought I would put my
two cents in. 1st: Your problem is with your understanding of the hour()
function. It returns 0-23 depending on what time of a day it is. It is
supposed to be used with extracting the time of day from a date. 2nd: when
times are entered into a cell, they are not stored as a time (not they way
you think of it anyway). They are stored as days (to be more exact the
number of days from 1/0/1900, if no date is accompanying the time). So in
your example 25:28 is really 1.0611 days (or 25.4666 hours, or even 1/1/1900
1:28 AM). You can see this by formatting it as general (or to see the date:
m/d/yyyy h:mm AM/PM). So in Peo's answer you are simply converting days to
hours and dropping the fraction. If you think in these terms, it might help
you in the future with some other problems.

"Steven" wrote:

I am calculating overtime and have a time of 25:28. That is 25 hours and 28
minutes. It is formatted Custom [h]:mm so you actually see the 25:28 in the
cell. I want to pull the hours into a sererate cell as 25 in this case. I
keep getting a 1 and if I try to add this hour and another number it gives me
another confusing answer.

My question is how do I return the hours (25 in this case) to its own cell
and have it actually be a value of 25.

Thank you for your help.

Steven

  #5   Report Post  
 
Posts: n/a
Default

An alternative aproach
one way to extract the hours is using the TEXT function

=--TEXT(A1,"[h]")
just using the double unarry to coerce the text to numeric

I am not sure if this is slower than the =INT(A1*24) but could be more
accessible to the less knowledgable

cheers RES
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
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Hyperlinks using R[1]C[1] and offset function in its cell referenc Elijah-Dadda Excel Worksheet Functions 0 March 5th 05 03:31 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM
Find a Function to use accross different worksheets R. Hale Excel Worksheet Functions 3 November 25th 04 07:07 AM


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