HOUR Function
Returns the hour portion (0-23) of a time value.
Syntax
Parameters
| Parameter | Description | Required |
|---|---|---|
| serial_number | A date-time serial (or a time fraction). The integer part is a date and the fractional part is the time; the hour is taken from the fractional part. | Required |
Basic Example
Get the hour from a time
=HOUR(TIME(12, 30, 0))TIME(12,30,0) is 12:30 PM, so HOUR returns 12.
Advanced Examples
Example 1: Extract hour from a date-time serial
A timestamp like 2024-01-15 18:00HOUR reads the fractional time part
=HOUR(45305.75)Example 2: Midnight returns 0
A date with no time componentA whole-number serial has no time fraction
=HOUR(45305)How HOUR Works
HOUR takes the fractional part of the serial (the time-of-day component) and multiplies it by 24, then returns the integer hour from 0 (midnight) to 23 (11 PM). The date portion is ignored.
Important Notes & Limitations
HOUR ignores the date portion entirely.
A value with no time fraction (a whole number) returns 0, which can look wrong if you expected a time.
It accepts only valid serials; text times must be converted first.
Common Errors & Fixes
#VALUE!The argument is text that Excel cannot parse as a time.Fix: Convert the text to a real time serial first (e.g. with TIMEVALUE).
Returns 0 unexpectedlyThe serial is a whole number with no time part.Fix: Make sure the value actually contains a time fraction.
Download Practice File
HOUR
hourPractice HOUR with Real Data
Download a sample CSV file with pre-populated data and practice exercises for the HOUR function. Works in both Excel and Google Sheets.
File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps