Calculating difference between start and end time

jessika2105

New Member
Joined
Oct 4, 2022
Messages
1
Office Version
  1. 2003 or older
Platform
  1. Mobile
Hi. I have checked on Internet. If I enter 8:00 pm in start time (cell A2)and enter 8:00 am in End time. (Cell B2). To calculate the difference, I have inserted the formula = (b2-a2)*24 I have then converted the formating to General to have the number of hours. However why I am getting -12
Second question from 8:00 pm to 8:00 am, I should get 11 hours, but I'm getting -13
Kindly help me
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Flaiban

Board Regular
Joined
Jul 28, 2022
Messages
93
Office Version
  1. 2016
Platform
  1. Web
Try this formula :
=IF(end>start, end-start, 1-start+end)
example : =IF(B2>A2;B2-A2;1-A2+B2)

To see the result in hours and minutes, apply a time number format like this: hh:mm
 
Upvote 0

AhoyNC

Well-known Member
Joined
Oct 10, 2011
Messages
5,113
Office Version
  1. 365
Platform
  1. Windows
Another option.
Format cell as [h]:mm

Book2
ABC
1
28:00 PM8:00 AM12:00
Sheet1
Cell Formulas
RangeFormula
C2C2=MOD(B2-A2,1)
 
Upvote 0

Forum statistics

Threads
1,186,530
Messages
5,958,344
Members
438,351
Latest member
MaykelKastelijn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top