Times formula - do they straddle midnight?

MOB

Well-known Member
Joined
Oct 18, 2005
Messages
1,056
Office Version
  1. 365
Platform
  1. Windows
I have 2 times in a spreadsheet - I need a formula to determine whether the start time and end time range include midnight eg;

21:00 03:00 Yes
08:00 20:00 No

I cant get my head round this, can anyone help?

TIA
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If these are times only and do not include dates then:

Excel Formula:
=IF(A1>B1,"Yes","No")

This assumes that the total time span is less than 24 hours. If you have a time span that crosses midnight but it's more than 24 hours, there is no way to tell. For example, in your second example, it is not possible to tell if the times are in the same day (16 hours) or the next day (30 hours).
 
Upvote 0
Thanks, I missed the obvious solution!
 
Upvote 0

Forum statistics

Threads
1,215,558
Messages
6,125,511
Members
449,236
Latest member
Afua

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