How to calculate hours between times after midnight in Excel?
Supposing you have a time table to record your work time, the time in Column A is the start time of today and time in Column B is the end time of the following day. Normally, if you calculate the time difference between the two times by directly minus "=B2-A2", it will not display the correct result as left screenshot shown. How could you calculate the hours between two times after midnight in Excel correctly?
Add a number of years / months / days / weeks / hours / minutes / seconds to date:
Kutools for Excel’s Formulas utility contains some commonly-used formulas, such as add years to date, calculate age based on birthday and so on. With these usual formulas, you can quickly get the result that you want without remembering any formulas.
Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!
To get the correct calculated result between two times over midnight, you can apply the following formula:
1. Enter this formula: =(B2-A2+(B2<A2))*24 (A2 is the earlier time, B2 is the later time, you can change them as you need) into a blank cell which beside your time data, see screenshot:
2. Then drag the fill handle to the cells that you want to fill this formula, and the time differences between two times after midnight have been calculated at once, see screenshot:
Recommended Productivity Tools
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 26 days agoCan someone explain when the function of addition of the TRUE/FALSE values does so I can understand the formula please?
To post as a guest, your comment is unpublished.· 1 months agoI think a simple MOD(B2-A2,1) should be enough?
To post as a guest, your comment is unpublished.· 1 years agoAustin, the formula stated in the article above works well for me
To post as a guest, your comment is unpublished.· 1 years agoThe formula under bullet point #1 is wrong. =(B2-A2+(B2<A2))*24, but is should read as =B2-A2+(B2<A2)*24.
The parentheses are in the wrong spot.
To post as a guest, your comment is unpublished.· 6 months agoTHANK YOU! This is definitely the correct formula.
To post as a guest, your comment is unpublished.· 9 months agoYes Austin! Your formula works, the other formula renders nonsense (in my case). Thanks!!
To post as a guest, your comment is unpublished.· 11 months agoNo, Austin's correction works for me. The original with the parentheses where they are shown does not work. Maybe a diifferent version of Excel makes a difference? I am on MS Home and Office 2016
To post as a guest, your comment is unpublished.· 11 months agoThe original formula works better than your suggestion Austin.
I also used =(A2-B2+(A2<B2))*1440
This worked best to convert time into minutes.