Hello. I have two sets of And statements with multiple conditions. They work properly when used in the worksheet as formulas checking dates.
When they are used in conditional formatting the conditional formatting does not work the same way and the wrong dates are highlighted.
The first rule should work this way with dates in column A beginning with A2:
If current month?s day number is >=1 and <= 15, highlight the dates in Column A >=16th to EOM of the previous month.
If I put my formula in B2 and drag down. True and false seem to match the expected outcome for the corresponding dates in column A.
=AND(DAY(TODAY())>=1,DAY(TODAY())<=15,A2>=DATE(YEAR(A2),MONTH(A2-1),16),A2<=EOMONTH(TODAY(),-1))
Using the same exact formula pasted into the conditional formatting highlights days 15-29 instead of 16-eom but using the formula shows the correct true and false next to the dates.
The second formula should work similarly but has the same problem: If the current month?s day number is >=16 and <= EOM day number, highlight the date 1-15 of the current month.
=AND(DAY(TODAY())>=16,DAY(TODAY())<=DAY(EOMONTH(TODAY(),0)),A2>=DATE(YEAR(TODAY()),MONTH(TODAY()),1),A2<=DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(15)))
When using the exact same formula in conditional formatting It highlights last day of previous month to the 14th day of current month but it seems the correct true and false output is next to the proper dates as expected.
I sincerely have no idea where I am going wrong. If anyone can let me know where I am going wrong I would really appreciate it.
Bookmarks