Conditional formatting help

Fegal

Board Regular
Joined
Feb 2, 2013
Messages
101
Office Version
  1. 365
Platform
  1. Windows
Hi All

Iam pulling my hair out, surely this is simple??
Can H12 be green if more than 14 hours, orange if less than 14 hours and red if less than 1 hour from now..

Fatigue 1.xlsx
DEFGH
6CURRENT TIME
713:19
8
9End of rest pre deployment8 hours restDeployed
10Date & TimeY/N Date & TimePre-deployment wake time17 Hour limit
11
125/04/2024 5:305/04/2024 17:00115/04/2024 22:30
13
145/04/2024 6:30y5/04/2024 17:00105/04/2024 23:30
155/04/2024 7:00y5/04/2024 17:00106/04/2024 0:00
165/04/2024 8:00y5/04/2024 17:0096/04/2024 1:00
175/04/2024 6:30y5/04/2024 17:00105/04/2024 23:30
185/04/2024 5:30y5/04/2024 17:00115/04/2024 22:30
Phase 1
Cell Formulas
RangeFormula
D7D7=NOW()
D12D12=IF(D14="","",MIN(D14:D28))
G12,G14:G18G12=IF(OR(D12="",F12=""),"",TEXT(F12-D12,"[H]"))
H12,H14:H18H12=IF(D12="","",D12+17/24)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H12Expression=I8>=0.583333textNO
H12Expression=I8>=0.708textYES
H12Expression=I8=0textYES
H12Expression=I8<0.58333textNO
E12:E28,E33:E70,E88:E120Cell Valuecontains "N"textNO
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
well that embarrising. cells are H12 not I8.. have changed it but its still not working correctly
 
Upvote 0
Thats a shame - can't see the values in column I :)

Your conditioning is a bit confusing. For example, if I8 is 0.9 it would be orange then red that are true.
A more logical set of conditions are:
H12Expression=I8>=0.708text REDYES
H12Expression=I8>=0.583333text ORANGEYES
H12Expression=I8>0text GREENNO
 
Upvote 0
Thanks for the replyRoborBob..

can you explain like im 5? im struggling with this one.
I can understand why H12 is orange and not red.
I would have thought it would have turned red at 5/4/24 22:30, orange at 5/4/24 19:30 and green before that.


Cell Formulas
RangeFormula
H12,H14:H18H12=IF(D12="","",D12+17/24)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H12Expression=H12>=0.583333textYES
H12Expression=H12>=0.708textYES
H12Expression=H12=0textNO
H12Expression=H12<0.58333textNO
 
Upvote 0
Heres another way the internet suggested but i cant seem to get it to work

Fatigue 1.xlsx
DEFGH
10Date & TimeY/N Date & TimePre-deployment wake time17 Hour limit
11
126/04/2024 5:306/04/2024 5:3006/04/2024 22:30
13
146/04/2024 6:006/04/2024 6:0006/04/2024 23:00
156/04/2024 5:306/04/2024 5:3006/04/2024 22:30
166/04/2024 5:306/04/2024 5:3006/04/2024 22:30
Phase 2
Cell Formulas
RangeFormula
D12D12=IF(D14="","",MIN(D14:D28))
F12F12=MIN(F14:F28)
G12,G14:G16G12=IF(OR(D12="",F12=""),"",TEXT(F12-D12,"[H]"))
H12,H14:H16H12=IF(D12="","",D12+17/24)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H12Expression=IF((H12-(NOW()-TODAY()))*1440>60,TRUE)textNO
H12Expression=IF((H12-(NOW()-TODAY()))*1440>840,TRUE)textNO
H12Expression=IF((H12-(NOW()-TODAY()))*1440<840,TRUE)textNO
E12:E28Cell Valuecontains "N"textNO
 
Upvote 0
A date/time is actually a number where the integer is the date and the decimals the time.

So to just examine the time you need to get rid of the integer.

Your original conditions should remove the integer before testing e.g.:
=H12-TRUNC(H12)>=0.583333

instead of:
=H12>=0.583333

Your last attempt needs better bracketing to ensure things are calculated in the right order.
 
Upvote 0
Thanks for your efforts.
understand the trunch, but i need to consider the date and time.
not sure how to improve the bracketing on the second attempt.

the original =H1>=058333 etc still isnt giving the correct output.
Guess ill put this in the too hard basket.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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