Formula to calculate time

asad

Well-known Member
Joined
Sep 9, 2008
Messages
1,434
Hi Guys,

I am a bit confused as to how can I calculate time in the following cases. I need to calculate time worked before 5:00 and after 19:00 for the given shift start and end times along with the meal break times.

StartMeal StartMeal EndMeal StartMeal EndFinishExpected Answer
03:5708:3409:2611:0411:5613:4401:03
13:4615:3416:2619:0419:5022:5903:13

<colgroup><col span="6"><col></colgroup><tbody>
</tbody>

Thanks for your help.

Asad
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
05:00 minus 03:57 = 01:03 which is your expected answer as per you example, what do you expect the answer to be?
 
Upvote 0
05:00 minus 03:57 = 01:03 which is your expected answer as per you example, what do you expect the answer to be?
That one works if there are no meal breaks within that time. Look at the second example. How much comes to using your formula?
 
Upvote 0
I forgot about my query but today I was working on it and worked out the formula that fits the criteria and gives correct answer. If someone wants it, here's how I did it.
I used two cells - I1 and J1 to enter the values 5:00 and 19:00.
Then I used this formula
Code:
=($I$1-MIN(A2,$I$1))+(F2-MIN(F2,$J$1))-(MAX($J$1,E2)-$J$1)+(MAX($J$1,D2)-$J$1)
It has worked for me. If someone can give me a better formula, please do so. I am always open to suggestions to learn more.
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top