Selected Answer
RWSM
Based on your clarification that period dates "run from 6th-20th and 21st - 5th" of each month, I've assumed that you have two period numbers, one odd and the other even,
Revision #1, 27 September 2024 (Revises equations to correct start/stop dates and to prevent errors in February).
In sheet "Automated Time sheet" of the revised file attached, cell D5 (font currently yellow to highlight) has this formula:
=IF(ISODD(V7),DATE(V3,V4,6),DATE(V3,V4,21))
so if V7 (filled yellow) is odd (e.g. 5), then D5 contains the date of the 6th of the month/year indicated by the cells above V7 (otherwise it's the 21st). It appears as a number since the formatting is Custom "d" to give the day of the month.
The cell to the right, E5, has the same formatting but is:
=D5 + 1
so the day after (and that's copied as far as Q5).
In R5, the end of the period may have been reached so the formula must chnage to test for that (and show nothing if the period is over). The formula in R5 is a Nested If staement:
=IF(Q5<>"",IF(DAY($D$5)=6,IF(DAY(Q5+1)<21,Q5+1,""),IF(Q5+1<EOMONTH($D$5,0)+5,Q5+1,"")),"")
where the outer IF tests to see if the previous cell was blank (in which case show another blank).. In the inner If, the True portion finds the end of the period if it's a period starting 6th while the FALSE outcome (in bold) checks for the end of a period which starts on 21st (and spills into the next month). That's copied to cell S5 too.
That means that row 5 could contain a blank at the end so C5 contains this:.
=IF(D5<>"",D5,"")
so if D5 isn't a blank, C5 contains the same date (but formatted Custom "ddd" to give the weekday e.g. Sat). That copied as far as S5
If you change V5 to 6, you'll see the period changes to suit.
Note that I changed the heading in row 3 to expand your formula, adding the bit in bold to become:
=TEXT(DATE(V3,V4,1),"[$-US-en]mmmm") &" "&V3 & IF(ISEVEN(V7), "/ " & TEXT(DATE(V3,V4+1,1),"[$-US-en]mmmm"),"")
This might give a heading like July 2024/ August if the period starts on the 22nd.
I had to replace your conditional formatting (and won't go into that) but the four rules are all based on the formula:
=IFERROR(IF(WEEKDAY(D$4,2)>5,1,0),0)
where the IFERROR prevents problems from a blank in row 4. The vatious shadings apply to different ranges.
I didn't do anything with the dates in the sheets now named "Holidays" but having rows 4 and 5 as dates should make it easier).
I left the sheet showng a February entry (to show a problem you had was fixed).
Hope I got this right. If so and this solves your problem, please be sure to mark this Answer as Selected.