Take date/time and calculate the time in between excluding weekends and including partial days (looking at full 24 hour days)

freeb1893

Board Regular
Joined
Jul 30, 2012
Messages
234
Office Version
  1. 365
Platform
  1. Windows
I have 2 dates with dates and time, where I'd like to subtract them and determine the amount of time between those dates. I'd like to exclude weekends in the result. I'd also like to consider only partial days if the time for either the 1st date or the 2nd date is within the day sometime.

Anyone know how to put this in a formula?

In cells A1 and B1 I have 2/19/2024 12:00PM and 2/20/2024 6:00PM respectively.

I'd like the result of my formula referencing those cells to be 1.25 days.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
You may have had you number formatting wrong

Book2
ABCDE
12/19/2024 12:00 PM2/20/2024 6:00 PM1.251 day 6 hours
22/18/2024 8:00 AM2/20/2024 6:00 PM2.422 days 10 hours
Sheet1
Cell Formulas
RangeFormula
D1:D2D1=B1-A1
E1:E2E1=LET(Days,INT(D1),Hours,ROUND((D1-INT(D1))*24,2),Days&IF(Days>1," days "," day ")&IF(INT(Hours)=Hours,TEXT(Hours,"#"),TEXT(Hours,"#.##"))&" hours")
 
Upvote 0
You may have had you number formatting wrong

Book2
ABCDE
12/19/2024 12:00 PM2/20/2024 6:00 PM1.251 day 6 hours
22/18/2024 8:00 AM2/20/2024 6:00 PM2.422 days 10 hours
Sheet1
Cell Formulas
RangeFormula
D1:D2D1=B1-A1
E1:E2E1=LET(Days,INT(D1),Hours,ROUND((D1-INT(D1))*24,2),Days&IF(Days>1," days "," day ")&IF(INT(Hours)=Hours,TEXT(Hours,"#"),TEXT(Hours,"#.##"))&" hours")
Thanks! Is there a way I can also integrate excluding weekends from the results?
 
Upvote 0
Book2
ABCDEF
12/16/2024 9:15 AM2/19/2024 10:15 AM1.041 day 1 hoursWeekend
22/14/2024 10:00 AM2/15/2024 4:00 PM1.251 day 6 hours
32/16/2024 9:15 AM2/16/2024 6:15 PM0.380 day 9 hours
42/1/2024 7:002/7/2024 17:004.424 days 10 hoursWeekend
Sheet1
Cell Formulas
RangeFormula
D1:D4D1=NETWORKDAYS(A1,B1)-2+(INT(A1)+1-A1)+(B1-INT(B1))
E1:E4E1=LET(Days,INT(D1),Hours,ROUND((D1-INT(D1))*24,2),Days&IF(Days>1," days "," day ")&IF(INT(Hours)=Hours,TEXT(Hours,"#"),TEXT(Hours,"#.##"))&" hours")



 
Upvote 0
Solution
Book2
ABCDEF
12/16/2024 9:15 AM2/19/2024 10:15 AM1.041 day 1 hoursWeekend
22/14/2024 10:00 AM2/15/2024 4:00 PM1.251 day 6 hours
32/16/2024 9:15 AM2/16/2024 6:15 PM0.380 day 9 hours
42/1/2024 7:002/7/2024 17:004.424 days 10 hoursWeekend
Sheet1
Cell Formulas
RangeFormula
D1:D4D1=NETWORKDAYS(A1,B1)-2+(INT(A1)+1-A1)+(B1-INT(B1))
E1:E4E1=LET(Days,INT(D1),Hours,ROUND((D1-INT(D1))*24,2),Days&IF(Days>1," days "," day ")&IF(INT(Hours)=Hours,TEXT(Hours,"#"),TEXT(Hours,"#.##"))&" hours")



That worked! Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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