HOUR
Returns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.).
=HOUR(serial_number)This static page keeps the function indexed for search, while the spreadsheet app handles interactive exploration and saved formulas.
What the function does
Overview
Returns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.).
The HOUR function extracts the hour component from a time value represented by an Excel serial number. The result is an integer ranging from 0 (for 12:00 AM) to 23 (for 11:00 PM). This function is particularly useful when you need to analyze or filter data based on the hour of the day, regardless of the minutes or seconds. The `umber` argument can be a number representing a date and time, a text string that Excel can parse as a time (e.g., "3:45 PM"), or the result of another function that returns a time value (like NOW() or TIME()). If the `umber` is a text string that cannot be interpreted as a time, HOUR will return a #VALUE! error. It's important to remember that Excel stores dates and times as serial numbers, where the integer part is the date and the decimal part is the time. HOUR only considers the decimal part, effectively ignoring any date component present in the serial number.
Quick reference
Syntax
=HOUR(serial_number)
Inputs
Arguments
Example: A2
Formula patterns
Examples
Extracting hour from a time string
=HOUR("3:30 PM")Extracting hour from a date-time cell
=HOUR(A2)Avoid these issues
Common Errors
#VALUE!
Cause: The 'serial_number' argument cannot be interpreted as a valid time by Excel.
Fix: Ensure the 'serial_number' is a valid Excel date/time serial number or a text string in a recognized time format.
#NUM!
Cause: The 'serial_number' argument is a number that is outside the valid range for Excel dates/times (e.g., a negative number).
Fix: Provide a valid positive serial number representing a date and/or time.
Platform support
Compatibility
Available in Excel 365 and earlier versions.
Source: Microsoft Support
Common questions
Frequently Asked Questions
Returns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.).
umber: A number in a date-time format or a text string representing a time.
#VALUE!: Ensure the 'umber' is a valid Excel date/time serial number or a text string in a recognized time format. #NUM!: Provide a valid positive serial number representing a date and/or time.