Calculate time shared by two intervals

Turn 2:30 to 5:30 PM and 4:30 to 7:30 PM into 1:00 of shared time.

What you'll make

In Excel: 2:30–5:30 PM and 4:30–7:30 PM becomes 1:00 shared.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1MIN(B8,D8)The earlier of the two end times.5:30 PM
2-MAX(A8,C8)Takes away the later of the two start times.1:00
3MAX(0, … )Shows 0:00 when the intervals don't overlap.1:00

Read it left to right. MAX wraps everything, so it works last.

=MAX(0,MIN(B8,D8)-MAX(A8,C8))

How to use it

Yellow bar at the top? Click Enable Editing.

  1. See it work. The Example tab shows 20 made-up examples with the formula already in.
  2. Use your own times. Paste each interval's start and end times into the green columns of the Template tab. The shared time fills in by itself.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

Put each start before its own end. For intervals across midnight, paste full dates with times. Intervals that only touch share 0:00.

Microsoft's help: MAX function