Conditional Formatting of entire Column based on Month Header

wanji

New Member
Joined
Apr 21, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I want to use conditional formatting to draw a box around a group of columns (in sets of 4) if they are within the current month. In my example I'd like to draw a box around C1:F7 because they all have a header that is within the month of April. In May, I'd want the box to move to G1:G7 because they are within the month of May. All grouping will be in columns of 4 so should be able to have a formula.

Conditional Formatting by Column Current Month.jpg
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
The finished result would look similar to this. I manually drew the box on this one. I'd want the box drawn around the columns with April because that's the month we are currently in.
Conditional Formatting by Column Current Month.jpg
 
Upvote 0
If I chose highlighting those 4 date columns instead of outlining would that make it easier? I just didn't want to highlight over the colored cell but I guess I could change that to text in those already colored cells. I haven't had any replies on my original question so maybe it's not doable. Thought that maybe another option might get me an answer.
 
Upvote 0
Is the number of rows fixed? I am going to assume yes.

It's doable. You need four separate rules. I don't know how many columns you are using so ? is the last column.

Rule in C1:?1
=MONTH(C$2)=MONTH(TODAY())
Add a border on the top

Rule in C1:?7
=AND(MONTH(C$2)=MONTH(TODAY()),MONTH(B$2)<>MONTH(TODAY()))
Add a border on the left

Rule in C1:?7
=AND(MONTH(C$2)=MONTH(TODAY()),MONTH(D$2)<>MONTH(TODAY()))
Add a border on the right

Rule in C7:?7
=MONTH(C$2)=MONTH(TODAY())
Add a border on the bottom

I have not tested this but would be happy to if you have a way to share your file.
 
Upvote 0
Try:

Book2
ABCDEFGHIJKLMN
1AprilMayJune
24/1/20214/1/20214/1/20214/1/20215/1/20205/1/20205/1/20205/1/20206/1/20206/2/20206/3/20206/4/2020
3Workplace IntelligenceNeeds Assessment
4Workplace Strategy
5Transaction ManagementSite Identification
6Evaluation of Alternatives
7Offer and Lease Negotiation
8
Sheet13
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B1:N7Expression=(EOMONTH(B$2,0)=EOMONTH(TODAY(),0))*(EOMONTH(B$2,0)<>EOMONTH(C$2,0))textNO
B1:N7Expression=(EOMONTH(B$2,0)=EOMONTH(TODAY(),0))*(EOMONTH(B$2,0)<>EOMONTH(A$2,0))textNO
1:1,8:8Expression=EOMONTH(A$2,0)=EOMONTH(TODAY(),0)textNO


XL2BB didn't pick up the specific formatting. The first rule would be to select the right border, the second rule would be to select the left border, and the last rule would be to select the top border. The top border of row 8 is the same as the bottom border of row 7, so we can save one rule. Also, using EOMONTH instead of just MONTH allows us to check if the year matches as well.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,934
Messages
6,175,486
Members
452,647
Latest member
MatthewBiersay

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