In this article, we will learn about how to calculate the Time difference in hours as decimal values in Excel.
In simple words, We need to get the time difference in hours using Excel MOD function and then we need to represent it in the decimal format.
MOD function returns the remainder when number gets divided by divisor.
Syntax for MOD function:
Number : The number to be divided
Divisor : The number to divide with.
Let’s understand this function using it an example.
Here we have some time fields named Start_time & End_time.
We need to calculate the time difference using MOD function. And then we will multiple by 24 to get the fraction value to hours in decimal value.
Use the formula to get positive Hours in decimal values:
B2-C2: takes the difference between the two times.
MOD function solves the problem of negative answers.
*24 : The number gets multiplied with 24 to get the hours in decimal values
Copy the formula in other cells using shortcut key Ctrl + D.
As you can see the MOD function gets the hours in decimal values and returns no result in negative hours.
You can also do the above process via just taking the difference and multiply the result with 24 to get hours in decimal value.
But here MOD function saved us the trouble of negative Hours.
Hope you understood how to take Time difference in hours as decimal values in Excel. Explore more articles on Excel Date & Time function here. Please feel free to state your query or feedback for the above article.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.