Calculating the number of hours between 2 dates/times

Drexl88

Board Regular
Joined
Jan 20, 2020
Messages
75
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm currently using the formula =MOD(D10-C10,1)*E10 to calculate the number of total hours allocated to a task based on the time difference between start time (D10)/end time(C10) and the number of staff involved (E10). However, I need to update the recordings to include date started (A10) & time started (D10) - date ended (B10) time ended (C10). What would the formula be to work our the hours between the start date/time and the end date/time.

Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
How about
Excel Formula:
=MOD((A10+D10)-(B10+C10),1)*E10
 
Upvote 0
Thanks Fluff, I've moved the columns round and the formula is returning 0 hours for some reason - =MOD((F2+G2)-(L2+M2),1)*N2

Cells: Start date F2/Start Time G2 -End Date L2/End time M2 - number of staff N2

Date format is DD/MM/YYYY and time format is 00:00:00 as a validation drop down.

Cheers
 
Upvote 0
In that case what are the exact values in those cells, can you post some sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Maybe:
Book1
ABCDEF
9StartEndEnd TimeStart TimeStaffTotal Hrs
102/10/20222/11/20224:00 PM10:00 AM260
Sheet1
Cell Formulas
RangeFormula
F10F10=((B10+C10)-(A10+D10))*24*E10
 
Upvote 0
In that case what are the exact values in those cells, can you post some sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Thanks Fluff ill take a look and use in the future.
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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