How to subtract date and time

dprice2000

New Member
Joined
Aug 10, 2006
Messages
8
I have:

Cell A1 03/12/2009 22:28:00
Cell B1 04/12/2009 10:40:00

I need to find out how many hours between these two dates and times.

Also need to then use that result in another formula so using Custom [hh]:mm doesn't seem to work.

Any help?

Thank you
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try;

=B1-A1

and format as '[h]:mm'

This gives 12:12, how do you mean that it is being used in another formula, and doesnt seem to work?

Can you explain a bit more?

Cheers
Colin
 
Upvote 0
Thanks for the answer.

Once i've found how many hours, I want to create another formula to see if the amount is over or under 24. Just doesn't seem to work.

=IF(C1<24,"On time","Over")


Thanks,
 
Upvote 0
24 hours is one day so it's:

=IF(C1<1,"On time","Over")

Also - if your timestamps are as per above you're cool, i.e. the date's are there too. However if you're working with JUST times, without dates in them, then you need something like:


=(B1 < A1) + B1-A1<A1) p + B1-A1<>
To handle cases where you start at 10:00 pm and end at 3:00 am (assuming it's 3 am the next day).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

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
Back
Top