Calculate number of hours between 2 dates

LearnMeExcel

Well-known Member
Joined
Aug 11, 2009
Messages
746
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi All Excel 2010
AB
1FromTo
215/03/201321/03/2013
318:0012:25
4
5
6I want to calculate number of hours from the date and time in column A To date ad time in column B
7How I could do it and round Number of hours Down
8From 12:25 to 12:00

<colgroup><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
LearnMeExcel,

There may well be a more elegant solution but given that you appear to have dates and times in separate cells, does this help....



Excel 2007
ABCDE
1FromToHours
215/03/201321/03/2013155
301:0012:25
Sheet1
Cell Formulas
RangeFormula
E2=((B2-A2)*24)+((N(MAX(HOUR(A3),HOUR(B3))-MIN(HOUR(A3),HOUR(B3))))*(IF(A3>B3,-1,1)))


Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,207,261
Messages
6,077,359
Members
446,279
Latest member
hoangquan2310

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