The HOUR function in Excel is designed to extract the hour component from a given time value. This function is particularly useful for analyzing time-based data, allowing users to isolate the hour component for further calculations, reporting, or analysis.
Syntax
HOUR(serial_number)
- serial_number: This is the time value or serial number from which you want to extract the hour. It can be provided directly as a time value or as a reference to a cell containing the time.
Example #1
HOUR("2:30 PM")
This function retrieves the hour from the time value of 2:30 PM, resulting in 14 since Excel stores time in a 24-hour format.
Example #2
HOUR(A1)
Assuming cell A1 contains the value 10:45:00, this function extracts the hour component, producing a result of 10.
Example #3
HOUR(0.5)
In Excel, 0.5 represents 12:00 PM. The function will return 12 as the resulting hour component.
Error handling
- VALUE!: This error occurs if the argument provided is non-numeric and cannot be interpreted as a valid time.
- NUM!: This error may arise if the serial number exceeds Excel’s limit for date and time values.