Half Day Conditional formatting

oO P2K Oo

New Member
Joined
Aug 12, 2018
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am trying to make a Gantt chart with a twist! I wish to split each day into AM and PM sessions. However I am looking for a formula that will work with conditional formatting, such that if the time is between 00:00-11:59 the cell is highlighted, and when the time is between 12:00-23:59 the corresponding cell is highlighted and the previous one is un-highlighted. I would be happy if the changes were updated when the workbook is saved, as I am sure the now formula should be used, and I understand it won't show until refreshed/saved.
I have added the "date and time" as an excel serial (so 44892 represents 27/11/22 AM and 44892.5 is 27/11/22 PM). So I am trying to link my NOW() or TODAY() formula to this value, but it just keeps churning out rubbish.
Non-macros preferred please, but open to VBA.

Any and all help would be appreciated.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hello.

Unfortunately I have absolutely no idea how your data looks like and what you mean.
Could you be more specific od provide some samples? At least some dummy data.

The below table is what I thought you need, but it most likely isn't.

Book1.xlsm
A
1Date & Time
211/26/2022 18:47
311/26/2022 20:15
411/26/2022 23:59
511/27/2022 0:00
611/27/2022 4:04
711/27/2022 7:01
811/27/2022 11:59
Sheet14
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A8Expression= AND(A2 - INT(A2) > 0.5, A2 - INT(A2) <= 1)textNO
A2:A8Expression= AND(A2 - INT(A2) >= 0, A2 - INT(A2) < 0.5)textNO
 
Upvote 0
I have tried to install the mini-sheet, but it won't let me install properly. I can select the range but copying it and showing the list of conditional formats are not proving successful at all.

so at best, I can provide you with screenshots.

So in cell BM15, I would like this to be shaded when the time is between 27/11/2022 00:00 and 27/11/2022 11:59. When the time changes to 27/11/2022, the cell BM15 is unshaded and the cell BN15 is shaded instead to represent that this cell is where the current time falls, so when viewing the overall project you have a visual indication of where you are in relation to the project.

Thank you for viewing my post and offering to help :)
 

Attachments

  • PM1.png
    PM1.png
    17 KB · Views: 6
  • PM2.png
    PM2.png
    26.3 KB · Views: 9
  • PM3.png
    PM3.png
    20 KB · Views: 6
  • PM4.png
    PM4.png
    8 KB · Views: 6
Upvote 0
I adapted your data, played around a little bit and I think, I've figured it out...

Here we go:

Book1.xlsm
ABCJKLMNOPQRSTUVWXBABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCACB
1
2
3
4
5
6Project Start Date10/31/2022
7
8
9WeekWeek 1Week 4Week 5
10Week starts on31/10/202221/11/202228/11/2022
11day of month31123456212223242526272829301234
12day of weekMTWTFSSMTWTFSSMTWTFSS
13AM/PMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPMAMPM
14
15NOW
16
Sheet12
Cell Formulas
RangeFormula
BA9,BO9BA9= AM9+1
K10K10= C6
BA10,BO10BA10= AM10+7
K11K11= K10
M11,O11,Q11,S11,U11,W11,BA11,BC11,BE11,BG11,BI11,BK11,BM11,BO11,BQ11,BS11,BU11,BW11,BY11,CA11M11= K11+1
K12,M12,O12,Q12,S12,U12,W12,BA12,BC12,BE12,BG12,BI12,BK12,BM12,BO12,BQ12,BS12,BU12,BW12,BY12,CA12K12= CHOOSE(WEEKDAY(K11,2),"M","T","W","T","F","S","S")
K13,M13,O13,Q13,S13,U13,W13,BA13,BC13,BE13,BG13,BI13,BK13,BM13,BO13,BQ13,BS13,BU13,BW13,BY13,CA13K13=K11
L13,N13,P13,R13,T13,V13,X13,BB13,BD13,BF13,BH13,BJ13,BL13,BN13,BP13,BR13,BT13,BV13,BX13,BZ13,CB13L13=K11+0.5
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K15:CB15Expression= NOT(MROUND(K$13,0.5) = MROUND( NOW(), 0.5))textNO
K15:CB15Expression= MROUND(K$13,0.5) = MROUND( NOW(), 0.5)textNO


Here's how it looks on my screen with all conditional, number and cell formats:

image_2022-11-28_002907203.png
 
Upvote 0
Solution

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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