Formula counting time between two dates

Zomo1985

New Member
Joined
Jul 23, 2018
Messages
2
Hello!

I need serious help creating a formula that:

1. Calculates the time between two dates - submitted and printed I.e

Submitted date
03-Jan-2017 16:33:46
Printed date
04-Jan-2017 12:39:48

2. And secondly shows as passed if lower than 24 hrs, or failed if greater than 24hrs.


Thanks in advance for any help!!!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Without the weekend, it's easy to get printed date - submitted then convert to hours or minutes to measure.

I'm not sure if there is other way to make it easier.
But here the way I do it long time ago. I add a lot additional column to break down calculate the time in each day.
Then get sum to calculate the total duration between submitted & printed.

K7pCPLS


I6 = 13 Jul ; J6 = 14 Jul;
The formula calculate hour in 13 Jul is:
=IF((IF($D7>J$6,J$6,$D7)-IF($C7<I$6,I$6,$C7))*24<0,0,(IF($D7>J$6,J$6,$D7)-IF($C7<I$6,I$6,$C7))*24*I$5)

I add the row 5 to check the weekend by: =IF(OR(WEEKDAY(I6)=1,WEEKDAY(I6)=7),0,1)
So if that day = weekend, the duration = 0.
 
Upvote 0
I just realize the formula is corrupted. Here the full formula.
It check the start & end time to calculate the overlap duration, then * 24 to convert from day to hour.

=IF((IF($D7>J$6,J$6,$D7)-IF($C7<I$6,I$6,$C7))*24<0,0,(IF($D7>J$6,J$6,$D7)-IF($C7<I$6,I$6,$C7))*24*I$5)
 
Upvote 0

Forum statistics

Threads
1,223,962
Messages
6,175,654
Members
452,664
Latest member
alpserbetli

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