Akire
Akire

Reputation: 169

Calculating which part of shift that falls within timespan

I am trying to make a formula to calculate how much of my shift that falls into another timespan (that gives extra shift hours)

I know how long my shift is, just need to have the red timespan in the picture.

E.g. I work between 15:00-23:00 and Timespan for extra payment is 19:00-24:00

The time I worked is 8 hours and 4 hours is extra pay, but is there any way to have a formula giving me this since I will have to do this for many dates and timespans...

enter image description here

Upvotes: 0

Views: 98

Answers (1)

pnuts
pnuts

Reputation: 59485

Assuming you have split your times (A start Shift, D end Extra Pay etc.) and times do not span midnight then:

=MIN(D1,B1)-MAX(C1,A1)

or =B1-C1.

Upvotes: 1

Related Questions