# Calculating hours

#### want to learn

##### New Member
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?

### Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

#### cpg84

##### Active Member
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
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
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

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

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

=MOD(C1-B1,1)

#### want to learn

##### New Member
Thanks to all, I found what the combination that works.
Thank you Cammy84

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,989
Messages
5,834,737
Members
430,315
Latest member
bobh63

### 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.

### Which adblocker are you using?

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

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