Conditional formatting if date falls within last 4 calendar quarters

amphead

New Member
Joined
May 24, 2023
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I'm trying to add a formula using conditional formatting to see if a cell(G10) falls within the previous 4 calendar quarters of a date in another cell(M2). I've not been able to find a way to make it work. Any suggestions?

I'm using MS 365 Excel

Book1.xlsx
ABCDEFGHIJKLMNOPQRST
1Service Performed
2Instrument RackDate6/25/20242Quarter2024
3SourceDescriptionFreq.Date Performed
41Clean Instrument RackQ6/25/2024
51Visual InspectionQ6/25/2024
6Air Supply
7SourceDescriptionFreq.Date Performed
81Inspect inlet pressure gaugeQ6/25/2024
91Relieve trapped water from filter cupQ6/25/2024
101Change Coalescing FilterA1/1/2022
11
Service Checklist
Cell Formulas
RangeFormula
P2P2=ROUNDUP(MONTH(M2)/3,0)
S2S2=YEAR(M2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G9:I9Expression=(ROUNDUP(MONTH(G9)/3,0))<>P2textNO
G8:I8Expression=(ROUNDUP(MONTH(G8)/3,0))<>P2textNO
G5:I5Expression=(ROUNDUP(MONTH(G5)/3,0))<>P2textNO
G4:I4Expression=(ROUNDUP(MONTH(G4)/3,0))<>P2textNO
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
can you give an example of 4 calendar quarters - isnt that a YEAR ???

so M2 = 25/6/24

what would be the start date of the 4th calendar quarter - IE how far back do you go with that date

25/6/23 OR ??????
 
Upvote 0
Yes, it's a year. However, I can just use 365 days since the date in M2 may not be the first day of the quarter. I'm trying to make the cell turn yellow if the task in C10 is due the same quarter as listed in M2. The letters in F9 and F10 are for quarterly and annual. I was able to get the conditional formatting to work for cell G9 quarterly, but not G10 for annual.

1st quarter = 1/1 - 3/31
2nd quarter = 4/1 - 6/30
3rd quarter = 7/1 - 9/30
4th quarter = 10/1 - 12/31

Using the date of 6/25/24. It's in 2nd quarter, so I want to check if the date in cell G10 is older than the beginning of quarter 3 in 2023 or 7/1/23.
 
Upvote 0
I made a mistake on my response earlier. I meant to say I can't use 365 days. Just using the past year may not line up with the calendar quarters.
 
Upvote 0
thanks still not following sorry
go back 4 quarters

25/6/24 - go back 4 quarters - so that in Q2 , go back 4 - Q1,Q4,Q3,Q2 , so 1 April -
Then look at G10 and see if that date , falls within that date - 1/oct/23

which is NO

BUT you say
so I want to check if the date in cell G10 is older than the beginning of quarter 3 in 2023 or 7/1/23.
OLDER and 3 Qtrs
so go back 3 qtrs and Q1,Q4, Q3 , 1st July

BUT then in the Original post you say
cell(G10) falls within the previous 4 calendar quarters of a date in another cell(M2). I
SO falls within - OR older
Q3 - counting the current quarter as 1 or Q4 go back for qtrs
 
Upvote 0
Sorry for the confusion. I'll see if I can clarify.

25/6/24 - go back 4 quarters - so that in Q2 , go back 4 - Q1,Q4,Q3,Q2 , so 1 April - I made a mistake, it should go back 3 quarters, so July 1.
Then look at G10 and see if that date , falls within that date - 1/oct/23 - I need to check if G10 is between July 1, 2023 and the date listed in M2

which is NO

BUT you say
so I want to check if the date in cell G10 is older than the beginning of quarter 3 in 2023 or 7/1/23.
OLDER and 3 Qtrs
so go back 3 qtrs and Q1,Q4, Q3 , 1st July - Yes, it should go back 3 quarters, so 1st July. It looks like I said "falls within" and then "older than". I didn't realize I did that when I typed the response. I need it to color the cell yellow if it doesn't fall with the dates (July 1, 2023-June 25,2024) or is older than the 1st July. Would one of those methods work better or be easier?

BUT then in the Original post you say
cell(G10) falls within the previous 4 calendar quarters of a date in another cell(M2). I
SO falls within - OR older - Sorry for the confusion on using both of those terms in my question. I'm guessing it may be easier to go older than the previous 3 quarters.
Q3 - counting the current quarter as 1 or Q4 go back for qtrs - If counting the current quarter listed in M2, then go back 3 additional quarters. Using the date of 6/25/24 in my example: its Q2 2024, so July 1, 2023.
 
Upvote 0
I was able to come up with a solution to my problem. I setup the conditional formatting with this formula: =(DATEDIF(G10, M2, "m")/3)>3.75. I can adjust the 3.75 number to look back more or less quarters if needed in the future.

Book1.xlsx
ABCDEFGHIJKLMNOPQRS
1Service Performed
2Instrument RackDate6/30/20242Quarter2024
3SourceDescriptionFreq.Date Performed
41Clean Instrument RackQ6/25/2024
51Visual InspectionQ6/25/2024
6Air Supply
7SourceDescriptionFreq.Date Performed
81Inspect inlet pressure gaugeQ6/25/2024
91Relieve trapped water from filter cupQ6/25/2024
101Change Coalescing FilterA6/30/2023
11
Service Checklist
Cell Formulas
RangeFormula
P2P2=ROUNDUP(MONTH(M2)/3,0)
S2S2=YEAR(M2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G10:I10Expression=(DATEDIF(G10, M2, "m")/3)>3.75textNO
G9:I9Expression=(ROUNDUP(MONTH(G9)/3,0))<>P2textNO
G8:I8Expression=(ROUNDUP(MONTH(G8)/3,0))<>P2textNO
G5:I5Expression=(ROUNDUP(MONTH(G5)/3,0))<>P2textNO
G4:I4Expression=(ROUNDUP(MONTH(G4)/3,0))<>P2textNO
 
Upvote 0
Solution
glad you managed to sort out - good solution, i was a long way from that
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,178
Members
452,615
Latest member
bogeys2birdies

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