Advanced Excel
About Lesson

Function 8: HOUR()


📘 Definition:

The HOUR() function returns the hour component (0–23) from a time value.
It’s commonly used in time-tracking, attendance systems, or billing systems that depend on time duration — for example, employee login/logout or shift management.


🧩 Syntax:  =HOUR(serial_number)

  • serial_number → A valid time value (e.g., 8:30 AM or a cell reference containing time)


🧠 Example (Indian Perspective):

Time Formula Result
8:45 AM =HOUR(A2) 8
1:15 PM =HOUR(A3) 13
9:05 PM =HOUR(A4) 21

In India, most workplaces use 24-hour format internally for accurate time tracking (e.g., 1 PM = 13 hours).


🪜 Step-by-Step Explanation:

  1. Suppose A2 = 8:45 AM

  2. Formula → =HOUR(A2)

  3. Excel extracts the hour part (8) and ignores minutes/seconds.

  4. You can combine this with other formulas like MINUTE() or SECOND() for detailed breakdowns.


💡 Tip:

If your time is stored as text like "8:45 AM", first convert it:

 
=HOUR(TIMEVALUE(A2))

🎯 Why It’s Useful:

  • For attendance or shift duration analysis.

  • To group data based on time intervals (e.g., morning, afternoon, evening).

  • To calculate hourly sales or productivity in call centers, hospitals, or delivery firms.


🧑‍💻 Project Task 1: Employee Login Time Analysis

Employee ID Login Time Hour Shift
E101 8:45 AM    
E102 9:10 AM    
E103 12:30 PM    
E104 3:15 PM    

👉 Tasks:

  1. Extract the hour using =HOUR(B2)

  2. Use an IF formula to assign shifts automatically:

    • Morning: 6–11

    • Afternoon: 12–17

    • Evening: 18–23

  3. Create a summary table showing how many employees came in each shift.


🧑‍💻 Project Task 2: Cab Service Hourly Demand Tracker

Booking ID Pickup Time Hour Time Slot
B001 6:05 AM    
B002 9:30 AM    
B003 2:15 PM    
B004 8:50 PM    
B005 11:10 PM    

👉 Tasks:

  1. Use =HOUR(B2) to extract the hour.

  2. Use a nested IF or CHOOSE formula to assign time slots like:

    • 4 AM–9 AM → “Morning Ride”

    • 10 AM–4 PM → “Day Ride”

    • 5 PM–11 PM → “Evening Ride”

    • 12 AM–3 AM → “Night Ride”

  3. Create a Pivot Chart showing number of bookings per time slot.