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

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.


Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


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)

Simple Formula with Condition to Calculate Hours between Two Times after Midnight

  • Press the Enter button.

We get a result that is expressed as a fraction of a day.

  • Now, drag the Fill Handle icon downwards.

Simple Formula with Condition to Calculate Hours between Two Times after Midnight

  • Select all the resultant cells. Press the right button of the mouse.
  • Choose Format Cells from the Context Menu.

Simple Formula with Condition to Calculate Hours between Two Times after Midnight

  • We enter the Format Cells window.
  • Choose the Time option from the Number tab.
  • Now, select our desired form from the Type box.

Simple Formula with Condition to Calculate Hours between Two Times after Midnight

  • Finally, press OK to get the result.

Read More: Calculate Hours Between Two Dates and Times in Excel Excluding Weekends


Similar Readings


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)

IF Function calculate hours between two times in Excel

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

IF Function calculate hours between two times in Excel

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.

Read More: How to Subtract Minutes from Time in Excel (7 Methods)


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)

Excel MOD Function to calculate hours

  • 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

Alok

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

Leave a reply

ExcelDemy
Logo