Conditional format dates based on year/quarter

Beau the dog

Board Regular
Joined
Mar 8, 2021
Messages
74
Office Version
  1. 365
Platform
  1. Windows
So, I have a list of data (obviously!). I want to highlight the rows based on which year and which quarter I select. I realise this is purely for aesthetics, but I'm a little OCD with that! The word "Quarter" is in Cell A1. So I've selected 4th quarter and year 2021 in cells B1 and C1 respectively, so row 3,4 and 5 should be highlighted, I'd like to colour entire rows please.


Quarter42021
MonthPassFailPass %
Oct-2140100%
Nov-217370%
Dec-2150100%
Jan-2220100%
Feb-2220100%
Mar-224180%
Apr-2260100%
May-2230100%
Jun-222250%
Jul-221100%
Aug-2250100%
Sep-2220100%
Oct-2240100%
Nov-2260100%
Dec-224180%
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
How about
+Fluff 1.xlsm
ABCD
1Quarter22022
2MonthPassFailPass %
3Oct-2140100%
4Nov-217370%
5Dec-2150100%
6Jan-2220100%
7Feb-2220100%
8Mar-224180%
9Apr-2260100%
10May-2230100%
11Jun-222250%
12Jul-221100%
13Aug-2250100%
14Sep-2220100%
15Oct-2240100%
16Nov-2260100%
17Dec-224180%
18
19
Lists
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:D100Expression=AND(YEAR($A3)=$C$1,MEDIAN(MONTH($A3),$B$1*3,$B$1*3-2)=MONTH($A3))textNO
 
Upvote 0
how about
=AND(ROUNDUP(MONTH($A3)/3,0)=$B$1, YEAR($A3)=$C$1)

Book1
ABCD
1Quarter42021
2MonthPassFailPass %
3Oct-2140100%
4Nov-217370%
5Dec-2150100%
6Jan-2220100%
7Feb-2220100%
8Mar-224180%
9Apr-2260100%
10May-2230100%
11Jun-222250%
12Jul-221100%
13Aug-2250100%
14Sep-2220100%
15Oct-2240100%
16Nov-2260100%
17Dec-224180%
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:D17Expression=AND(ROUNDUP(MONTH($A3)/3,0)=$B$1, YEAR($A3)=$C$1)textNO
 
Upvote 0
Solution
Both of these solutions work perfectly, thank you both :)

I flipped a coin as who to mark as solution!!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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