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

**Table of Contents**hide

**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 **Exce**l. 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.

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

**Similar Readings**

**How to Calculate Hours and Minutes in Excel (7 Handy Ways)****Calculate Time Difference Between AM and PM in Excel****How to Calculate Cycle Time in Excel (7 Examples)****Calculate Hours from Date and Time in Excel****How to Use Time Format in Excel VBA (Macro, UDF, and UserForm)**

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

**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)`

- 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

**Calculate Hourly Rate in Excel (2 Quick Methods)****How to Subtract Date and Time in Excel (6 Easy Ways)****Calculate Elapsed Time Between Two Dates in Excel (5 Methods)****How to Subtract Time in Excel (7 Quick Methods)****Calculate Time in Excel (16 Possible Ways)****How to Calculate Difference Between Two Dates and Times in Excel**