# Excel Calculate Hours between Two Times after Midnight (3 Methods)

Get FREE Advanced Excel Exercises with Solutions!

Calculating time is usually seen for hourly wages-based workers. It may be seen that working is long, maybe work finish after midnight. In that situation, calculating work time is a bit complicated. In this article, we are going to discuss how to calculate hours between times after midnight in Excel.

## 3 Methods to Calculate Hours between Two Times after Midnight in Excel

We will show 3 methods to calculate hours between two times after midnight in Excel. We have a dataset to calculate the time difference. Where start time is in the present day and the end time is in the next day. We will calculate the time difference between them. ### 1. Use a Simple Excel Formula to Calculate Hours between Two Times after Midnight

We will apply a simple formula based on the subtraction and comparison to get the time difference.

📌 Steps:

• First, add a column on the right side of the dataset. • Now, go to Cell D5 and put the following formula.
`=(C5-B5)+(C5<B5)` • Press the Enter button. We get a result that is expressed as a fraction of a day.

• Now, drag the Fill Handle icon downwards. • Select all the resultant cells. Press the right button of the mouse.
• Choose Format Cells from the Context Menu. • We enter the Format Cells window.
• Choose the Time option from the Number tab.
• Now, select our desired form from the Type box. • Finally, press OK to get the result. ### 2. Apply Excel IF Function to Get Difference between Two Times after Midnight

In this method, we will use the IF function. This will calculate the time difference by comparing the start and end times in Excel.

The IF function checks whether a condition is met and returns one value if TRUE and another value if FALSE. 📌 Steps:

• Copy and paste the following formula on Cell D5.
`=IF(C5>B5,C5-B5,1-B5+C5)` • Press the Enter button to apply this formula. Here, we get the result in desired time format as cells are formatted already.

• Now, drag the Fill Handle icon downwards. We get the same result as Method 1.

This formula will compare the start and the end time. If the end time is greater than the start time then subtract the start time from the end time. Otherwise, subtract the start time from 1 and then add the end time.

### 3. Apply Excel MOD Function

This MOD function can solve this most simple way. No need to think about other things when using the MOD function!

The MOD function returns the remainder after a number is divided by a divisor. 📌 Steps:

• Put this formula on Cell D5.
`=MOD(C5-B5,1)` • Press the Enter button and drag the Fill Handle icon downwards. We get the result easily.

## 💬 Note

To get the result in the appropriate format, each time we need to change the format of the result cells.

## Conclusion

In this article, we described how to calculate between two times after midnight. We used different functions to perform this. I hope this will satisfy your needs. Please have a look at our website Exceldemy.com and give your suggestions in the comment box.

## Related Articles Alok Paul

Hello, this is Alok. I am working as an Excel & VBA Content Developer at Exceldemy. I want to provide solutions to various Excel-based problems. I completed my study at East West University major in Telecommunications Engineering. I love traveling, reading books, playing cricket.

We will be happy to hear your thoughts Advanced Excel Exercises with Solutions PDF  