What is the HOUR function?
=HOUR(serial_number)HOUR returns only the hour of a time as a number from 0 to 23.
You can pass a cell with a time, the result of TIME or NOW, or text such as "14:30:45". The part taken is highlighted in green.
Timesheets are the usual place for HOUR: counting how many people clocked in during each hour, or splitting off work done after 6 PM as overtime. Once a time becomes a plain hour number, COUNTIF can count each hour band and IF can sort shifts into early and late.
Arguments
- serial_number
- The time to take the hour from. If it includes a date, only the time part is used.
HOUR examples
Example 1. Take the hour
=HOUR("14:30:45")14.
Example 2. From the current time
=HOUR(NOW())The hour of the current time.
Example 3. The hour of different times
=HOUR(A2)Minutes and seconds are dropped and only the whole hour is left. 0.75 is three quarters of a day, so it is 18.
A2 =HOUR(A2) 9:05 9 13:45:30 13 23:59:59 23 0.75 18 Example 4. Early or late shift
=IF(HOUR(B2)<12, "Early", "Late")A start time B2 before noon is the early shift: 7:30 is Early and 13:00 is Late.
Common mistakes
Times over 24 hours
HOUR looks only at the time within a day. For totals over 24 hours, such as hours worked, multiply the value by 24 to get hours.
Text formats
Text Excel cannot read as a time returns #VALUE!.
Using it on elapsed time
For 27 hours of elapsed time HOUR returns 3, because the full day is dropped. Turn a total into hours with =A2*24.
Expecting it to round
HOUR of 9:59 is 9, not 10. To round half hours up, add first: =HOUR(A2+"0:30").
FAQ
- How do I put the parts back together?
- Use TIME.
- And the date part?
- Use YEAR, MONTH and DAY.
- How do I count entries per hour?
- Put =HOUR(A2) in a helper column and count with =COUNTIF(B:B, 9).
- How do I turn 9:30 into 9.5 hours?
- Use =A2*24 and format the result as General.