Calculating hours

want to learn

New Member
Joined
Aug 25, 2007
Messages
33
Cant figure this out!

I have a column with a date (8/24/2007) and column with a start time in 24 hour format 16:50:37and a column with a stop time in 24 hour format 3:23:29. In the cells to the right I want the total number of hours:minutes:seconds from the time the event started till it stopped. As you can see the time crossed midnight.

Can someone help me with this formula?
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

cpg84

Active Member
Joined
Jul 16, 2007
Messages
259
Have you tried to put both the date and time in the same cell? If you can, I will tell you what formula I used in a similar situation.
 

want to learn

New Member
Joined
Aug 25, 2007
Messages
33
Since there could be thousands of rows it would take alot of time to add the date to the time cell unless there is a formula for that as well. I can add the date to that cell to see the formula you use.
 

cpg84

Active Member
Joined
Jul 16, 2007
Messages
259
Let's say A1 has the first date and B1 has the second date.

Number of hours(in C1): =ROUNDDOWN((B1-A1)*24,0)
Number of minutes(in D1): =ROUNDDOWN((B1-A1)*1440,0)-(C1*60)
Number of seconds(in E1): =ROUNDDOWN((B1-A1)*86400,0)-(C1*3600)-(D1*60)

I have no idea how to have the date and time together, except writing them in the same cell. I have only done this to a small group of numbers, rather than heaps and heaps of numbers.
 

facethegod

Well-known Member
Joined
Aug 1, 2006
Messages
767

ADVERTISEMENT

A1-start time B1-end time, code in C1


Code:
=TEXT(MOD((B1-A1)*24,24)/24,"[h]:mm:ss")
 

cblincoln43

Board Regular
Joined
Mar 12, 2002
Messages
206

Watch MrExcel Video

Forum statistics

Threads
1,123,281
Messages
5,600,720
Members
414,401
Latest member
grenona2020

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
Top