Hour() function

The Excel HOUR function returns the hour component of a time as a number between 0-23. For example, with a time of 9:30 AM, HOUR will return 9. You can use the HOUR function to extract the hour into a cell, or feed the result into another formula, like the TIME function.

 

Syntax

The syntax for the HOUR function in Microsoft Excel is:

=Hour( serial_number )

Parameters or Arguments

serial_number

The time value to extract the hour from. This may be entered to the function as either:

  • A decimal (serial number) representation of an Excel time;
  • A text representation of a time;
  • A reference to a cell containing a time;
  • A time value returned from another Excel function or formula.

Note that, if the serial_number argument contains a date and time, the Hour function ignores the date part of the argument.

 

Returns

The HOUR function returns a numeric value between 0 and 23.

 

Hour Function Examples

In column B of the following spreadsheet, the Excel Hour function is used to extract the hour from several different supplied times.

Formulas:

Results:

 

Note that, in the above spreadsheet, the time shown in cell A5 is actually a whole day plus the time 05:11:22. Therefore, when supplied with this value, the Hour function ignores the full day and simply returns the hour value 5.

Similarly, the date part of the value in cell A6 is ignored, and the hour function simply returns the hour value 8.

 

Hour Function Error

If you get an error from the Excel Hour Function, this is likely to be the #VALUE! error:

#VALUE! – Occurs if the supplied serial_number is not a valid Excel time.