Conditional Formatting for time

benmurgatroyd

New Member
Joined
Jun 21, 2018
Messages
2
Hi,

I'm trying to set up a conditional format for cells to change colour based on a value in another cell. For example:

A2 is a time (06:00). In B2 and C2 there are two different times (07:15 & 07:45). I need the cell that is under 90 minutes (B2) to highlight green and the cell that is over 90 minutes (C2) to change red based on the time entered in cell A2.

I have tried multiple formats but none produce the results I'm looking for. Any help would be much appreciated.

Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to Mr Excel forum

You need two rules in CF

Select B2:C2

Rule 1
Home > Conditional Formatting > New Rule > Use a formula to determine...
Insert this formula
=B2=MEDIAN($A2,B2,$A2+TIME(1,30,0))
Format --> Green

Rule 2
Home > Conditional Formatting > New Rule > Use a formula to determine...
Insert this formula
=B2<>MEDIAN($A2,B2,$A2+TIME(1,30,0))
Format --> Red

Hope this helps

M.
 
Upvote 0
Thanks M.

That has worked great but the cells in B2 & C2 are coloured red even when no value has been entered (they change to red/green once I've entered a time in both cells). Some of the cells won't have values entered daily so when not in use I need them to show as white/empty. How can I get them to stay blank until I've entered the value which triggers the conditional format rules?
 
Upvote 0
Thanks M.

That has worked great but the cells in B2 & C2 are coloured red even when no value has been entered (they change to red/green once I've entered a time in both cells). Some of the cells won't have values entered daily so when not in use I need them to show as white/empty. How can I get them to stay blank until I've entered the value which triggers the conditional format rules?

Adjust the formula in Rule 2 to
=AND($A2<>"",B2<>"",B2<>MEDIAN($A2,B2,$A2+TIME(1,30,0)))

M.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,194
Members
449,072
Latest member
DW Draft

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