Formula for minutes early and late before and after midnight.

Jingles_88

New Member
Joined
Feb 7, 2016
Messages
6
Hi,


I have been working on a spreadsheet which displays the minutes a vehicle if early or late on site. My problem however is that some of the arrivals happen after midnight (00:00); and the formulas i have been using work for wither before or after, not both.


Scheduled On SiteOn SiteOn Site Variance
23:37
23:30
01:20
02:05

<tbody>
</tbody>





I have used the below formula that i found in another forum:
=IF(B2<A2,(B2+1)-(A2),(B2-A2))


The only issue is when the vehicle is early and before midnight the time is incorrect. If i remove the +1 in (B2+1), that issue is solved, but it no longer calculates passed midnight times.


I was wondering if there's a formula that is able to do both. Also, is there a way in which a value doesn't appear in the "On Site Variance" column until a time is entered into the corresponding cell in the "On Site" column.


Any help is greatly welcomed, i have stuck on this for some time.


Many Thanks,


John.
 
Re: [SOLVED] Formula for minutes early and late before and after midnight.

Thanks again Marcel, couldn't have done it without you.

John.
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,217,413
Messages
6,136,474
Members
450,015
Latest member
excel_beta_345User

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