How to Calculate Hours Between Two Times in Excel

Today, we’re tackling a super practical skill: calculating hours between two times. Whether you’re tracking work hours, billing clients, or managing project timelines, mastering this will save you tons of time.

Example 1: Basic Time Difference – Employee Shift Hours

Let’s start with the fundamentals. Imagine you’re managing a coffee shop, and your barista, Maria, works from7:30 AM to 3:45 PM. Let’s calculate her total hours step by step.

Click  on cell C2. Type 

=B2 - A2

Press Enter.     

The result might look like 0.34375 (decimal) or 8:15 AM(time).

Right-click C2 > Format  Cells > Custom.

In theType field, type [h]:mm.

Example 2: Overnight Shifts – Solving Midnight Crossings

Now, let’s tackle a common headache: overnight shifts. Imagine your security guard, Alex, clocks in at 10:00 PMand clocks out at6:30 AM. A simple subtraction might break—here’s how to fix it step by step.

In  cell C3, type 

=B3 - A3 

and press Enter

Result: ##### or -0.6458

Let’s use the MOD function to handle negative results.

Type the below formula  inC3.

=MOD(B3 - A3, 1)

Press Enter.     

The decimal 0.354 appears.

Right-click C3 > Format Cells > Custom.

In  theType field, type [h]:mm and click OK.

The cell now shows 8:30.

Video:

Leave a Reply