Calculate Time and Date between 2 Date

earthworm

Well-known Member
Joined
May 19, 2009
Messages
773
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I need to calculate date and time as under
Suppose

Start date and time = 3 May 2024 8:45 PM

End Date and time = 7 May 2024 3:PM

Saturday Sunday excluded

How time time it took between start date and end date in total duration in Hours and Days
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Will this work?

Book2
ABC
3Fri5/3/2024 8:45
43 days 23 hours 1 minutes
5Tue5/7/2024 15:00
Sheet1
Cell Formulas
RangeFormula
A3,A5A3=B3
C4C4=NETWORKDAYS(B3,B5)+TIME(24,0,0)&" days "&TEXT((B3-INT(B3))+(B5-INT(B5)),"hh")&" hours "&TEXT((B3-INT(B3))+(B5-INT(B5)),"m")&" minutes"
 
Upvote 0
I think it returned 3 days because the beginning time was in the morning and the end time is in the afternoon. Subtracting one day may solve the issue

Book2
ABC
3Fri5/3/2024 8:45
42 days 23 hours 1 minutes
5Tue5/7/2024 15:00
Sheet1
Cell Formulas
RangeFormula
A3,A5A3=B3
C4C4=NETWORKDAYS(B3,B5)+TIME(24,0,0)-1&" days "&TEXT((B3-INT(B3))+(B5-INT(B5)),"hh")&" hours "&TEXT((B3-INT(B3))+(B5-INT(B5)),"m")&" minutes"
 
Upvote 0
I again jumped the gun and thought I had solved it quickly until I took a harder look

Book2
ABC
3Fri5/3/2024 8:45
42 days 6 hours 15 minutes
5Tue5/7/2024 15:00
Sheet1
Cell Formulas
RangeFormula
A3,A5A3=B3
C4C4=NETWORKDAYS(B3,B5)-1&" days "&HOUR(MOD(1-(B3-INT(B3))+(B5-INT(B5)),1))&" hours "&MINUTE(MOD(1-(B3-INT(B3))+(B5-INT(B5)),1))&" minutes"
 
Upvote 0
I again jumped the gun and thought I had solved it quickly until I took a harder look

Book2
ABC
3Fri5/3/2024 8:45
42 days 6 hours 15 minutes
5Tue5/7/2024 15:00
Sheet1
Cell Formulas
RangeFormula
A3,A5A3=B3
C4C4=NETWORKDAYS(B3,B5)-1&" days "&HOUR(MOD(1-(B3-INT(B3))+(B5-INT(B5)),1))&" hours "&MINUTE(MOD(1-(B3-INT(B3))+(B5-INT(B5)),1))&" minutes"
I haven't tried it can you please convert the answer in whole number for easy reference
 
Upvote 0
You should try it. You could remove this portion: &MINUTE(MOD(1-(B3-INT(B3))+(B5-INT(B5)),1))&" minutes"
 
Upvote 0
If you are willing to work with Power Query, then look at this link for an alternative means

 
Upvote 0
I think this should work if your dates don't start or end on weekends.
Book1
ABCD
1StartEnd
25/3/May 8:455/7/May 15:0054:15<- Total Time (h:m). Formatted as [h]:mm
32<- Days. Formatted as General
46:15<- hours:minutes. Formatted as [h]:mm
Sheet6
Cell Formulas
RangeFormula
C2C2=NETWORKDAYS(A2,B2)-1+MOD(B2,1)-MOD(A2,1)
C3C3=INT(C2)
C4C4=MOD(C2,1)
 
Last edited:
Upvote 0
another option

T202405.xlsm
ABC
1StartEnd
2Fri 3-May-24 8:45Tue 7-May-24 15:0054:15
4f
Cell Formulas
RangeFormula
C2C2=(B2-A2-NETWORKDAYS.INTL(A2,B2,"1111100"))
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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