SOLVED

Time Formatting

Copper Contributor

If Cell A1 contains 8:00 AM and Cell B1 contains 3:00 PM and I wanted to know the difference between those two times inorder to calculate the total hours worked. As Im well aware of the fact that Excel consider Time 8:00 AM as 8/24 and for 3:00PM as (12+3)/24 so to get my answer as '7 ' I used the formula

 

(B1-A1)*24 

decides to mutiply by 24 get to get the number 7

 

But everytime when I used the above formula my answer always comes as 12:00 AM instead of 7

so I Click on the cell that I entered my formula and click General in Number formatting and when I do that I get the desired asnwer(7).

 

Just wanted to know if there's a way to get the answer as 7 without clicking eveytime on the cell to change it to general? As I dont understand Why I have to change to general each time? 

2 Replies
best response confirmed by kafka42 (Copper Contributor)
Solution

@kafka42 

The formula =B1-A1 subtracts two times and returns the result as time, which is reasonable.

Sometimes, you want to multiply this, for example to take overtime into account. For example, if time on Sunday counts double: =(B1-A1)*2. It is still reasonable to display this as time.

So it's difficult for Excel to "know" that you DON'T want =(B1-A1)*24 to display as time.

Thanks for your clarification!! Really helpful.
1 best response

Accepted Solutions
best response confirmed by kafka42 (Copper Contributor)
Solution

@kafka42 

The formula =B1-A1 subtracts two times and returns the result as time, which is reasonable.

Sometimes, you want to multiply this, for example to take overtime into account. For example, if time on Sunday counts double: =(B1-A1)*2. It is still reasonable to display this as time.

So it's difficult for Excel to "know" that you DON'T want =(B1-A1)*24 to display as time.

View solution in original post