ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   get total hours from 2 dates (https://www.excelbanter.com/excel-worksheet-functions/35463-get-total-hours-2-dates.html)

LU

get total hours from 2 dates
 
I need the total time from to dates.
My class starts on 6/10/2005 8:00
My class end on 6/11/2004 16:00

My excel spreadsheet has 6/10/2005 8:00 in one cell and 6/11/2004 16:00 in
another.

When I just do a date difference I get about 32 total hours which is wrong.
The total hours should be 16 hours since the class runs from 8:00 to 16:00
each day.
Help please

Biff

Hi!

If your class days are always Monday through Friday you could use the
Networkdays function for this.(and the formula would be less complicated
than the one below!)

Here's something that will work:

A1 = 6/10/2005 8:00
B1 = 6/11/2004 16:00

=((INT(B1)-INT(A1))-1)*8/24+SUM(MIN(16/24,MOD(B1,1))-8/24,MAX(16/24,MOD(A1,1))-8/24)

Format the cell as [h]:mm

Biff

"LU" wrote in message
...
I need the total time from to dates.
My class starts on 6/10/2005 8:00
My class end on 6/11/2004 16:00

My excel spreadsheet has 6/10/2005 8:00 in one cell and 6/11/2004 16:00 in
another.

When I just do a date difference I get about 32 total hours which is
wrong.
The total hours should be 16 hours since the class runs from 8:00 to 16:00
each day.
Help please





All times are GMT +1. The time now is 07:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com