HOUR Function

Excel Functions › Date & Time

All Excel versions

The Excel HOUR function pulls the hour out of any time as a plain number from 0 (midnight) to 23 (11 PM). Because Excel stores times as fractions of a 24-hour day — 0.5 is noon, 0.75 is 6:00 PM — you can’t just look at the stored number to get the hour; HOUR decodes it for you. It works on real times, full date-time stamps, and even text like "6:45 PM". Its siblings MINUTE and SECOND extract the other two components, and TIME puts them back together.


Quick answer: to get the hour from the timestamp in A2:
=HOUR(A2)
For 6/12/2026 2:30 PM the result is 14 — HOUR always speaks 24-hour clock, never AM/PM.

Syntax

=HOUR(serial_number)
ArgumentDescription
serial_numberRequiredThe time to read: a cell with a time or date-time, a TIME/TIMEVALUE result, a raw day fraction like 0.75, or quoted text such as "6:45 PM".

How Excel stores times: every time is a fraction of one day — 0.25 is 6:00 AM, 0.5 is noon, 0.75 is 6:00 PM. HOUR multiplies that fraction back into clock units and hands you the hour as an integer from 0 to 23. Any date part of the value is simply ignored. Available in every version of Excel.

Pull the hour from a timestamp

Column A holds order timestamps. HOUR, MINUTE, and SECOND take each one apart — note row 5: a bare day fraction works just as well as a formatted time:

ABCD
1Timestamp=HOUR(A)=MINUTE(A)=SECOND(A)
26/12/2026 8:26:05 AM8265
36/12/2026 2:30:00 PM14300
46/12/2026 11:59:59 PM235959
50.751800
=HOUR(A2) // returns 8 for 8:26:05 AM

HOUR is the standard tool for bucketing events by hour of day — pair it with TEXT for a readable label:

=HOUR(A2) & ":00–" & HOUR(A2)+1 & ":00" // label like 8:00-9:00
=COUNTIFS(B:B, 14) // orders in the 2 PM hour, with =HOUR(...) in helper column B

Try it: interactive HOUR demo

Live demo

Pick any time and watch HOUR, MINUTE, and SECOND take it apart — plus the day fraction Excel stores behind the scenes.

Decimal hours and shift logic

Payroll and billing want 8.5 hours, not 8:30. Rebuild a decimal from the components:

=HOUR(A2) + MINUTE(A2)/60 + SECOND(A2)/3600 // time-of-day as a decimal, e.g. 14.5

For a duration (end minus start), skip HOUR entirely and convert the day fraction directly — multiply by 24:

=(B2 - A2) * 24 // hours worked as a decimal: 0.354 day becomes 8.5

Classic shift test — flag anything starting before 9 AM or after 5 PM:

=IF(OR(HOUR(A2)<9, HOUR(A2)>=17), "Off-hours", "Business hours")

Remember: HOUR answers “what hour does the clock show?” — not “how many hours is this?”. For elapsed hours, multiply the difference by 24.

Errors & common pitfalls

#VALUE! — text Excel can’t read as a time. =HOUR("2:30 PM") works, but =HOUR("half past two") or a time with stray characters fails. Clean the text first, or parse it explicitly with TIMEVALUE.

Pitfall: expecting 12-hour numbers. HOUR returns 0–23. For 11:30 PM it returns 23, never “11 PM”. Need a 12-hour label? Use =TEXT(A2, "h AM/PM") instead.

Pitfall: using HOUR on durations. A duration cell showing 26:00 (format [h]:mm) stores 1.0833 days — and =HOUR of it returns 2, because HOUR ignores whole days. For elapsed hours use =A2*24 or =INT(A2*24).

Pitfall: midnight returns 0. Both a date-only cell (no time part) and a genuine 12:00 AM stamp give =HOUR(...) = 0. If zeros look suspicious, check whether your timestamps actually contain times.

Practice workbook

📊
Download the free HOUR practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

Why does HOUR return 14 instead of 2 PM?
HOUR always uses the 24-hour clock, returning an integer 0–23, so 2:30 PM is 14. For a 12-hour display, format the source cell or use =TEXT(A2,"h AM/PM").
How do I get total elapsed hours between two times?
Don't use HOUR — it reads the clock, not the gap, and it ignores whole days. Subtract and multiply by 24: =(B2-A2)*24 returns 8.5 for a shift from 9:00 AM to 5:30 PM. Excel times are day fractions, so ×24 converts to hours.
Does HOUR work on text like "6:45 PM"?
Yes — =HOUR("6:45 PM") returns 18, because Excel converts recognizable time text on the fly. Unrecognizable text gives #VALUE!. For imported data it’s safer to convert once with TIMEVALUE and reference real times.
Why does HOUR return 0 for my dates?
A date with no time component is a whole number — its time portion is exactly midnight, so HOUR returns 0. The function isn't broken; the cells just don't contain times.
How do I count rows that fall in a given hour?
Add a helper column =HOUR(A2) and count it: =COUNTIF(B:B, 14) for the 2 PM hour. Or in one step: =SUMPRODUCT(--(HOUR(A2:A500)=14)).

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: MINUTE · SECOND · TIME · TIMEVALUE · TEXT