Forum Discussion
Conditional formatting based on time (00:00:00)
- Feb 09, 2023
Perhaps column D contains date + time values instead of just time values. Does this formula for the "green" rule work?
=OR(HOUR(D43)=8,HOUR(D43)=9)
Let's say the times will be entered in B2:B100.
Select this range. B2 should be the active cell within the selection.
Set the Fill Color to red. This will be the default.
On the Home tab of the ribbon, click Conditional Formatting > New Rule...
Select 'Use a formula to determine which cells to format'.
Enter the formula
=B2<>""
Click Format...
Activate the Fill tab.
Select orange.
Click OK, then click OK again.
Repeat these steps, but with the formula
=AND(B2>=TIME(8,0,0),B2<=TIME(10,0,0))
and green as fill color.
Thanks for your help, but it doesn't work for some reason. I'm doing something wrong, but I'm not sure what. Please, here is step by step of my work, maybe you can see something?
- HansVogelaarFeb 09, 2023MVP
Perhaps column D contains date + time values instead of just time values. Does this formula for the "green" rule work?
=OR(HOUR(D43)=8,HOUR(D43)=9)
- Szymon1983Feb 09, 2023Copper ContributorThank You Hans
You're a Star 🙂 Is working now
Thanks