Know How to Calculate the Number of Hours in Excel

Are you looking to calculate the number of hours between two times in Excel? In this blog post, you will learn three easy methods that will save you time and reduce the chance of errors.

Calculating the number of hours between two times in Excel is crucial for various purposes, such as managing project time, analyzing efficiency, and tracking billable hours.

How to use Subtraction Operator

The simplest way to calculate the hours between two times in Excel is by using the subtraction operator.

How to use Subtraction Operator, Number of Hours in Excel

Suppose you have the employee SignIn and SignOut data in columns B and C.

Enter the subtraction formula: =C2-B2 in cell D2 and drag it to the range of cells D2:D6.  The result will be the number of hours between the two times.

How to use IF function

When dealing with employees who work at nightshift, where the SingOut is earlier than the SignIn, you can use the IF function to handle such situations.

Number of Hours in Excel

Enter the formula: =IF((C2-B2)<0,1-(B2-C2),(C2-B2)) in cell D2 and drag it to range of cells D2:D6. This formula will calculate the hours correctly, taking into account the crossing of midnight.

How to use the TEXT Function

You can use the TEXT function if you prefer to display the calculated hours as text strings in your report.

Number of Hours in Excel

Enter the text function formula: =TEXT(C2-B2,”hh:mm”) in cell D2 and drag it to the range of cells D2:D6.  

Conclusion

There is more than one formula to calculate the difference between start and end times. You learned three methods in this article and select any one of these methods to easily obtain accurate results and save time. Also, choose the one that depends on your dataset.

I hope this blog post has helped you to understand how to calculate the number of hours in Excel. If you have any questions or feedback, please leave a comment below.