Calculating difference in time - conditional formatting

Mux99

Board Regular
Joined
Apr 15, 2019
Messages
57
Hi all

I would like to calculate Time-in - Time-out and if there is less than a 9 hour difference, highlight the cells. In the example below B4:B5 & C2:C3 would be highlighted.

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Time-in[/TD]
[TD]Time-out[/TD]
[TD]Time-in[/TD]
[TD]Time-out[/TD]
[TD]Time-in[/TD]
[TD]Time-out[/TD]
[/TR]
[TR]
[TD]08:00[/TD]
[TD]18:00[/TD]
[TD]09:00[/TD]
[TD]22:00[/TD]
[TD]06:00[/TD]
[TD]17:00[/TD]
[/TR]
[TR]
[TD]12:00[/TD]
[TD]23:00[/TD]
[TD]07:00[/TD]
[TD]16:00[/TD]
[TD]10:00[/TD]
[TD]19:00[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,

Not quite sure about your example

In the example below B4:B5 & C2:C3 would be highlighted.

Where are all these cells exactly ?
 
Upvote 0
Hi,

Not quite sure about your example

Where are all these cells exactly ?

Sorry about that as I did not copy the whole table. I meant to say D2:E2 & B3:C3. Please see the example below

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]Time-in[/TD]
[TD]Time-out[/TD]
[TD]Time-in[/TD]
[TD]Time-out[/TD]
[TD]Time-in[/TD]
[TD]Time-out[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]08:00[/TD]
[TD]18:00[/TD]
[TD]09:00[/TD]
[TD]22:00[/TD]
[TD]06:00[/TD]
[TD]17:00[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]12:00[/TD]
[TD]23:00[/TD]
[TD]07:00[/TD]
[TD]16:00[/TD]
[TD]10:00[/TD]
[TD]19:00[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Hello,

Thanks for your clarification ...

For your range B2:F3 you can have following formula

Code:
=MOD(B2-A2,1)<0.375

Hope this will help
 
Upvote 0

Forum statistics

Threads
1,224,744
Messages
6,180,696
Members
452,994
Latest member
Janick

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