Can I do conditional formatting based on time?

Patikns23

New Member
Joined
Sep 21, 2022
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I have this spreadsheet that shows time clocked in by employee. There are two starting times - 5am and 5pm. I would like to conditionally highlight all times that are either after 5:00:00 AM if the time is AM and after 5:00:00 PM if the time is PM. If the cells are blank (days not worked), I would like no conditional formatting to be applied.

Is there a way to do this?

Thank you.

1674599217946.png
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Does this work for you?

Mr Excel Questions.xlsx
ABCD
1
25:05 AM
35:03 AM
44:55 AM
5
65:04 AM
74:56 AM
84:55 PM
94:58 PM
10
115:03 PM
124:56 PM
135:00 PM
14
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C13Expression=OR(AND(C2>TIME(5,0,0),C2<TIME(12,0,0)),AND(C2>TIME(17,0,0),C2<1))textNO
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

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