conditional formatting problem with time past midnight

jv3000

New Member
Joined
Jul 26, 2022
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
Hi situation
I made a conditional format so that a cell in column F turns into a colour when the data of the cell in column E is in between the data in cell F14 and G14.
what I want to achieve is for example: 23:45 counts in between 23:00 and 03:00 BUT 22:00 not.
data between.xlsx
EFGHIJK
9X22
10SCHEDULE
116345
1236/37IP38
13releasecleanreleasecleanreleaseclean
1423:003:00
1521:45
1622:00
1722:15
1822:30
1922:45
2023:00
2123:15
2223:30
2323:45
240:00
250:15
260:30
270:45
281:00
291:15
301:30
311:45
322:00
332:15
342:30
352:45
363:00
373:15
383:30
393:45
404:00
414:15
424:30
434:45
445:00
nacht shift
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F44:G44Expression=IF(E44>=F14;E44<G14)textNO
F43:G43Expression=IF(E43>=F14;E43<G14)textNO
F42:G42Expression=IF(E42>=F14;E42<G14)textNO
F41:G41Expression=IF(E41>=F14;E41<G14)textNO
F40:G40Expression=IF(E40>=F14;E40<G14)textNO
F39:G39Expression=IF(E39>=F14;E39<G14)textNO
F38:G38Expression=IF(E38>=F14;E38<G14)textNO
F37:G37Expression=IF(E37>=F14;E37<G14)textNO
F36:G36Expression=IF(E36>=F14;E36<G14)textNO
F35:G35Expression=IF(E35>=F14;E35<G14)textNO
F34:G34Expression=IF(E34>=F14;E34<G14)textNO
F33:G33Expression=IF(E33>=F14;E33<G14)textNO
F32:G32Expression=IF(E32>=F14;E32<G14)textNO
F31:G31Expression=IF(E31>=F14;E31<G14)textNO
F30:G30Expression=IF(E30>=F14;E30<G14)textNO
F29:G29Expression=IF(E29>=F14;E29<G14)textNO
F28:G28Expression=IF(E28>=F14;E28<G14)textNO
F27:G27Expression=IF(E27>=F14;E27<G14)textNO
F26:G49Expression=IF(E26>=F14;E26<G14)textNO
F25:G25Expression=IF(E25>=F14;E25<G14)textNO
F24:G24Expression=IF(E24>=F14;E24<G14)textNO
F23:G23Expression=IF(E23>=F14;E23<G14)textNO
F22:G22Expression=IF(E22>=F14;E22<G14)textNO
F21:G21Expression=IF(E21>=F14;E21<G14)textNO
F20:G20Expression=IF(E20>=F14;E20<G14)textNO
F19:G19Expression=IF(E19>=F14;E19<G14)textNO
F18:G18Expression=IF(E18>=F14;E18<G14)textNO
F17:G17Expression=IF(E17>=F14;E17<G14)textNO
F16:G16Expression=IF(E16>=F14;E16<G14)textNO
F15:G15Expression=IF(E15>=F14;E15<G14)textNO
J44:K44Expression=IF(E44>=J14;E44<K14)textNO
J43:K43Expression=IF(E43>=J14;E43<K14)textNO
J42:K42Expression=IF(E42>=J14;E42<K14)textNO
J41:K41Expression=IF(E41>=J14;E41<K14)textNO
J40:K40Expression=IF(E40>=J14;E40<K14)textNO
J39:K39Expression=IF(E39>=J14;E39<K14)textNO
J38:K38Expression=IF(E38>=J14;E38<K14)textNO
J37:K37Expression=IF(E37>=J14;E37<K14)textNO
J36:K36Expression=IF(E36>=J14;E36<K14)textNO
J35:K35Expression=IF(E35>=J14;E35<K14)textNO
J34:K34Expression=IF(E34>=J14;E34<K14)textNO
J33:K33Expression=IF(E33>=J14;E33<K14)textNO
J32:K32Expression=IF(E32>=J14;E32<K14)textNO
J31:K31Expression=IF(E31>=J14;E31<K14)textNO
J30:K30Expression=IF(E30>=J14;E30<K14)textNO
J29:K29Expression=IF(E29>=J14;E29<K14)textNO
J28:K28Expression=IF(E28>=J14;E28<K14)textNO
J27:K27Expression=IF(E27>=J14;E27<K14)textNO
J26:K49Expression=IF(E26>=J14;E26<K14)textNO
J25:K25Expression=IF(E25>=J14;E25<K14)textNO
J24:K24Expression=IF(E24>=J14;E24<K14)textNO
J23:K23Expression=IF(E23>=J14;E23<K14)textNO
J22:K22Expression=IF(E22>=J14;E22<K14)textNO
J21:K21Expression=IF(E21>=J14;E21<K14)textNO
J20:K20Expression=IF(E20>=J14;E20<K14)textNO
J19:K19Expression=IF(E19>=J14;E19<K14)textNO
J18:K18Expression=IF(E18>=J14;E18<K14)textNO
J17:K17Expression=IF(E17>=J14;E17<K14)textNO
J16:K16Expression=IF(E16>=J14;E16<K14)textNO
J15:K15Expression=IF(E15>=J14;E15<K14)textNO
H44:I44Expression=IF(E44>=H14;E44<I14)textNO
H43:I43Expression=IF(E43>=H14;E43<I14)textNO
H42:I42Expression=IF(E42>=H14;E42<I14)textNO
H41:I41Expression=IF(E41>=H14;E41<I14)textNO
H40:I40Expression=IF(E40>=H14;E40<I14)textNO
H39:I39Expression=IF(E39>=H14;E39<I14)textNO
H38:I38Expression=IF(E38>=H14;E38<I14)textNO
H37:I37Expression=IF(E37>=H14;E37<I14)textNO
H36:I36Expression=IF(E36>=H14;E36<I14)textNO
H35:I35Expression=IF(E35>=H14;E35<I14)textNO
H34:I34Expression=IF(E34>=H14;E34<I14)textNO
H33:I33Expression=IF(E33>=H14;E33<I14)textNO
H32:I32Expression=IF(E32>=H14;E32<I14)textNO
H31:I31Expression=IF(E31>=H14;E31<I14)textNO
H30:I30Expression=IF(E30>=H14;E30<I14)textNO
H29:I29Expression=IF(E29>=H14;E29<I14)textNO
H28:I28Expression=IF(E28>=H14;E28<I14)textNO
H27:I27Expression=IF(E27>=H14;E27<I14)textNO
H26:I49Expression=IF(E26>=H14;E26<I14)textNO
H25:I25Expression=IF(E25>=H14;E25<I14)textNO
H24:I24Expression=IF(E24>=H14;E24<I14)textNO
H23:I23Expression=IF(E23>=H14;E23<I14)textNO
H22:I22Expression=IF(E22>=H14;E22<I14)textNO
H21:I21Expression=IF(E21>=H14;E21<I14)textNO
H20:I20Expression=IF(E20>=H14;E20<I14)textNO
H19:I19Expression=IF(E19>=H14;E19<I14)textNO
H18:I18Expression=IF(E18>=H14;E18<I14)textNO
H17:I17Expression=IF(E17>=H14;E17<I14)textNO
H16:I16Expression=IF(E16>=H14;E16<I14)textNO
H15:I15Expression=IF(E15>=H14;E15<I14)textNO
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Do you really need four different conditional formatting colors, and a different rule for every row? It would be far easier to use one rule for all rows. At very least you should use one rule for each color.

In this example I used bold text for all rows, so there is only one rule.

Also, I highly recommend you get rid of merged cells.

$scratch.xlsm
ABCDEFG
1X22
2SCHEDULE
36345
436/37IP38
5releasecleanreleasecleanreleaseclean
623:003:00
721:45
822:00
922:15
1022:30
1122:45
1223:00
1323:15
1423:30
1523:45
160:00
170:15
180:30
190:45
201:00
211:15
221:30
231:45
242:00
252:15
262:30
272:45
283:00
293:15
303:30
313:45
324:00
334:15
344:30
354:45
365:00
Time Between
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A7:C36Expression=AND($A7>=$B$6,$A7<$C$6+IF($C$6<$B$6,1,0))textNO
 
Upvote 0
Do you really need four different conditional formatting colors, and a different rule for every row? It would be far easier to use one rule for all rows. At very least you should use one rule for each color.

In this example I used bold text for all rows, so there is only one rule.

Also, I highly recommend you get rid of merged cells.

$scratch.xlsm
ABCDEFG
1X22
2SCHEDULE
36345
436/37IP38
5releasecleanreleasecleanreleaseclean
623:003:00
721:45
822:00
922:15
1022:30
1122:45
1223:00
1323:15
1423:30
1523:45
160:00
170:15
180:30
190:45
201:00
211:15
221:30
231:45
242:00
252:15
262:30
272:45
283:00
293:15
303:30
313:45
324:00
334:15
344:30
354:45
365:00
Time Between
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A7:C36Expression=AND($A7>=$B$6,$A7<$C$6+IF($C$6<$B$6,1,0))textNO
Hi, thanks for your answer! the 4 colors are necessary. I made a rule for every row because I didn't know better. In your example the time in collom 1 is highlighted, I want the colors to be highlighted
 
Upvote 0
What determines the colors you are using in the original?

You will need a different conditional formatting rule for each color, based on the logic I provided.
 
Upvote 0
What determines the colors you are using in the original?

You will need a different conditional formatting rule for each color, based on the logic I provided.
Blue means released too early, green on time. Orange means the wave closed (clean) almost nearly too late, red means closed too late
 
Upvote 0
That is not meaningful to me based on your data. What I was getting at was how you determine which color goes in which row.

It looks to me like what you are trying to do is take the light colors you have assigned in your original layout, and use CF to replace them with darker versions of these colors if the time falls in the desired interval.

You need four rules:

Blue fill
Excel Formula:
=AND($A15>=$B$6,$A15<$C$6+IF($C$6<$B$6,1,0))
Applies To F15:K15

Green Fill
Excel Formula:
=AND($A16>=$B$6,$A16<$C$6+IF($C$6<$B$6,1,0))
Applies To F16:K19

Orange Fill
Excel Formula:
=AND($A20>=$B$6,$A20<$C$6+IF($C$6<$B$6,1,0))
Applies To F20:K21

Red Fill
Excel Formula:
=AND($A22>=$B$6,$A22<$C$6+IF($C$6<$B$6,1,0))
Applies To F22:K44
 
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,418
Members
452,325
Latest member
BlahQz

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