ExcelDateBeginner

HOUR

Returns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.).

Read the syntaxReview worked examplesOpen the spreadsheet app
=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

serial_numberA number in a date-time format or a text string representing a time.
Example: A2

Formula patterns

Examples

1

Extracting hour from a time string

=HOUR("3:30 PM")
time extractiontext to number
2

Extracting hour from a date-time cell

=HOUR(A2)
date-time analysistime component

Avoid these issues

Common Errors

1

#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.

2

#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

Excel 2007+Google Sheets

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.