The HOUR function in Google Sheets is a powerful tool designed to extract the hour from a given time value. This function is particularly useful for time-based calculations and data analysis, allowing users to isolate the hour component easily and incorporate it into various formulae.
Syntax
HOUR(time)
- time: The time value from which you want to extract the hour. This can be a cell reference or a direct time input.
Example #1
HOUR("14:30")
This function retrieves the hour from the specified time string “14:30”, resulting in 14.
Example #2
HOUR(A1)
If cell A1 contains the time value 09:45 AM, this function returns 9, representing the hour component.
Example #3
HOUR("00:15:30")
This call extracts the hour from the time 00:15:30, yielding a result of 0.
Error handling
- VALUE!: This error occurs when the input is not recognized as a valid time format, such as a text string that does not represent time.
- NUM!: This error arises when the input time value is outside the acceptable range, typically if it represents a negative time or an overly large hour value.