Spreadsheet Practice

HOUR function

Quick answer

HOUR returns the hour of a time as a number from 0 to 23, so 1:45 PM gives 13.

Syntax
=HOUR(serial_number)
Most common use
=HOUR(A2) returns 13 (The time part of 1/5/2026 1:45 PM: 13)

Use it to bucket timestamps by hour, flag late check-ins or count orders per hour. It reads the time part of a date and time, and also accepts times typed as text, like "1:45 PM".

Available in
Every current version
Category
Date functions
Returns
A whole number from 0 to 23.
Google Sheets
Works the same in Google Sheets.

Syntax

=HOUR(serial_number)

ArgumentRequired?What it is
serial_numberRequiredA time, a date and time, or time text.

Examples

Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.

CellFormulaResultWhat it shows
B2=HOUR(A2)13The time part of 1/5/2026 1:45 PM: 13
B3=HOUR(A3)77:30 AM is hour 7
B4=HOUR(A4)18Time typed as text works too: 18

Try it live

This is the sample sheet. Change any number or text, or edit a formula, and the results update.

Show the sample data as a table
TimestampResult
1/5/2026 13:45:0013
7:30 AM7
6:05 PM18

Practice HOUR

Graded instantly, then re-checked on changed data.

Hour of each order

In B2, return the hour (0–23) of each order timestamp in A2. Fill down to B7.

Common mistakes

What you seeWhy, and how to fix it
#VALUE!The cell holds text that isn't a time. Look for stray characters.
Always 0The cell holds a date with no time, which is midnight.

Tips

  • =SUMPRODUCT(--(HOUR(A2:A100)=9)) counts timestamps in the 9 AM hour without a helper column.

Questions

How do I extract the hour from a time in Excel?

=HOUR(A2) returns 0–23. =TEXT(A2,"h AM/PM") gives a label like 1 PM.

How do I turn a time into decimal hours?

=A2*24 turns a time into hours as a decimal: 1:30 becomes 1.5.

Updated Checked by running: every formula on this page was run by our formula engine on .