Conditionally format weekends, invalid dates

Mindlesh

Board Regular
Joined
Apr 2, 2014
Messages
172
Given a sheet with 13 columns (A:M), and one row (A32:M32) of month ("mmm") names, how can I conditionally format weekends and (separately) invalid dates? (Column A can be either the current or the next month.)
 
yep
that would work
as posted in my first reply
 
Last edited:
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
If A32 is Jan-2017, then these cells should be formatted as weekends: A1; A7:A8; A14:A15; A21:A22; A28:A29.
 
Upvote 0
you mean highlighted using conditional formatting
same range in B - M
select the range
A1; A7:A8; A14:A15; A21:A22; A28:A29. - M

and then use conditional formatting

see attached sample

https://www.dropbox.com/s/fejtk2w19dfol3m/Cond_Frmt_Non_consec_etaf.xlsx?dl=0


 
Upvote 0
Highlight your range (A1:M32) and use this Conditional Formatting formula:
Code:
=WEEKDAY(DATE(YEAR(A$32),MONTH(A$32),ROW()),2)>5
 
Upvote 0
Highlight your range (A1:M32) and use this Conditional Formatting formula:
Code:
=WEEKDAY(DATE(YEAR(A$32),MONTH(A$32),ROW()),2)>5

This is looking good, thank you; I have just applied the formatting to A1:M31 to avoid treating row 32 as dates. How can I apply a separate format to block out invalid dates; eg. 29-31 Feb 2017?
 
Upvote 0
Try a second conditional formatting formula like this:
Code:
=MONTH(DATE(YEAR(A$32),MONTH(A$32),ROW()))<>MONTH(A$32)
And then you can choose black highlighting to black out that cell.
 
Upvote 0
You are welcome!

The trick there with that one is that with the DATE function, if you enter in too many days, it will not return an error, it spills over to the next month.
For example, =DATE(2017,2,30) will return March 2, 2017
So what I did was simply extract the month from the calculated date for that row, and compare it to the month in Row 32 to see if it was the same or not.
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,318
Members
449,218
Latest member
Excel Master

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