How to Use the HOUR Function in Excel

Today, let’s explore the concept of time manipulation in Excel and Google Sheets with an emphasis on the HOUR function. This function is essential for extracting the hour part from a time value in a cell. It proves extremely useful for conducting calculations or analyses that depend on the hour component of a timestamp.

Syntax

The syntax for the HOUR function is consistent across both Excel and Google Sheets:

=HOUR(serial_number)
  • serial_number – This is the time value from which you wish to extract the hour. It could be a cell reference that includes a date and time, a function that outputs a date and time, or a numerical value that Excel interprets as a date and time.

Examples

Example 1: Basic Usage

Consider a scenario where cell A1 contains the timestamp 9/25/2023 14:30:00. To extract the hour component from this timestamp, use the formula:

Data Formula Result
9/25/2023 14:30:00 =HOUR(A1) 14

Example 2: Calculating Overtime Pay

Suppose you have a list of employee clock-in times in column A and need to compute the total overtime hours worked. By combining the HOUR function with other functions, you can accomplish this task. If the standard workday is 8 hours, use the following formula to calculate overtime hours:

Clock-in Time Overtime Calculation
8:30:00 =MAX(0, HOUR(A2)-8)

This formula deducts 8 hours (regular work hours) from the hour extracted in cell A2. If the result is negative, it indicates that no overtime was worked, and the MAX function ensures that the displayed value does not drop below zero.

Conclusion

Both Excel and Google Sheets offer the HOUR function as a straightforward and effective tool for extracting the hour part from a timestamp, facilitating various calculations and analyses. Whether it’s tracking work hours, crunching time-based data, or carrying out any time-sensitive tasks, mastering the use of the HOUR function can dramatically enhance your productivity.

More information: https://support.microsoft.com/en-us/office/hour-function-a3afa879-86cb-4339-b1b5-2dd2d7310ac7

Other functions
Returns the serial number of a particular date
Calculates the number of days, months, or years between two dates This function is useful in formulas where you need to calculate an age
Converts a date in the form of text to a serial number
Converts a serial number to a day of the month
Returns the number of days between two dates
Calculates the number of days between two dates based on a 360-day year
Returns the serial number of the date that is the indicated number of months before or after the start date
Returns the serial number of the last day of the month before or after a specified number of months
Returns the number of the ISO week number of the year for a given date
Converts a serial number to a minute
Converts a serial number to a month
Returns the number of whole workdays between two dates
Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days
Returns the serial number of the current date and time
Converts a serial number to a second
Returns the serial number of a particular time
Converts a time in the form of text to a serial number
Returns the serial number of today's date
Converts a serial number to a day of the week
Converts a serial number to a number representing where the week falls numerically with a year
Returns the serial number of the date before or after a specified number of workdays
Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days
Converts a serial number to a year
Returns the year fraction representing the number of whole days between start_date and end_date