I was demonstrating using the fill handle to create lists of weekdays recently when one of my trainees asked whether we could instead produce a calendar with weekends greyed out.
The answer is to use conditional formatting.
I first of all used the Autofill handle to put the days of the week on the top row and the dates on the second row. In this instance, my first column has times of day in it, though it could have anything needed.
Now, I selected the cell range that I wanted to format in this case A1:AE21.
Then I went to Home tab, Styles group, Conditional Formatting – New Rule. From Select a Rule Type I chose Use a formula to determine which cells to format. In the Format values where this formula is true I typed
Then clicked Format. In this instance I went to the Fill tab and chose a shading colour, then clicked OK twice.
I did similarly for Sunday. Probably if I had thought about it for longer I could have combined the two!
What happens though if we don’t have days of the week in our worksheet, just dates? In this case we would have to use the WEEKDAY function to work out the days of the week first. Sunday is weekday 1 and Sunday is weekday 2.
In this case the formulas are
=WEEKDAY(A$1)=1 and =WEEKDAY(A$1)=7
Find out more about our Microsoft Excel training Sydney, Australia.