DEV Community

Andrews
Andrews

Posted on • Originally published at geekexcel.com on

Excel Formulas to Calculate the Number of Hours between Two Times!!

Calculating the duration between two times can be a little tricky depending on the number of minutes and seconds in the two times being compared. So here, we will show the simple formula to calculate the number of hours between two times in Excel. Let’s get into this article!! Get an official version of ** MS Excel** from the following link: https://www.microsoft.com/en-in/microsoft-365/excel

Calculate Number of hours
Calculate the Number of hours

General Formula:

  • If you want to calculate the number of hours between two times, you can use the below formula.

=IF(end>start, end-start, 1-start+end)

Syntax Explanations:

  • IF – In Excel, the IF Function will help to return one value for a TRUE result, and another for a FALSE result.
  • Start – The value represents the starting time from the input.
  • End – It specifies the end time.
  • Comma symbol (,) – It is a separator that helps to separate a list of values.
  • Parenthesis () – The main purpose of this symbol is to group the elements.
  • Plus operator (+) – This symbol is used to add the values.
  • Minus Operator (-) – This symbol will help to subtract any two values.

Practical Example:

Let’s consider the below example image.

  • Here, we will enter the input values in Column B and Column C.
  • Now we are going to find the time duration between these two input times.

Input Ranges
Input Ranges

  • So, apply the above-given formula to the formula bar section and press the ENTER key.

Enter the formula
Enter the formula

  • Finally, we will get the result in the selected cell.

Result
Result

Closure:

From this article, you can get to know how to calculate the number of hours between two times in Excel. Hope you guys like it. Don’t forget to share your worthwhile feedback with us. Thank you so much for visiting our site. Click here to know more about *Geek Excel **and Excel Formulas *!! **

Read Ahead:

Top comments (0)