Visualize date ranges in a calendar in excel
Here is a picture of a simple calendar.
I have used conditional formatting to:
- highlight date ranges (green)
- highlight possible overlapping dates (red)
- not exisiting dates (black)
Here are the date ranges:
How I created "invisible" dates in cell range B3:AF14
- Formula in B3: =DATE($D$1;ROWS($A$3:$A3);B$2) + ENTER.
$D$1 is an absolute reference to a cell containing a year. - Copy cell B3 and paste into cell range B3:AF14.
- Select B3:AF14
- Press CTRL + 1
- Select "Number" tab
- Select "Custom"
- Type ,,, in "Type:" window
- Click OK!
How to highlight date ranges green (conditional formatting)
- Select B3:AF14.
- Click "Home" tab
- Click "Conditional formatting" button
- Click "New Rule.."
- Select "Use a formula to determine which cells to format"
- Type in "Format values where this formula is true" window: =SUMPRODUCT((B3<=$I$19:$I$26)*(B3>=$E$19:$E$26))=1
- Click "Format.." button
- Click "Fill" tab
- Select a color (green)
- Click OK!
- Click OK!
- Click OK!
How to highlight overlapping date ranges red (conditional formatting)
- Select B3:AF14.
- Click "Home" tab
- Click "Conditional formatting" button
- Click "New Rule.."
- Select "Use a formula to determine which cells to format"
- Type in "Format values where this formula is true" window: =SUMPRODUCT((B3<=$I$19:$I$26)*(B3>=$E$19:$E$26))>1
- Click "Format.." button
- Click "Fill" tab
- Select a color (red)
- Click OK!
- Click OK!
- Click OK!
How to highlight not existing dates black (conditional formatting)
- Select B3:AF14.
- Click "Home" tab
- Click "Conditional formatting" button
- Click "New Rule.."
- Select "Use a formula to determine which cells to format"
- Type in "Format values where this formula is true" window:=MONTH(B3)<>ROWS($B$3:$B3)
- Click "Format.." button
- Click "Fill" tab
- Select a color (black)
- Click OK!
- Click OK!
- Click OK!
How to reorder conditional formatting rules
- Click "Home" tab
- Click "Conditional formatting" button
- Click "Manage Rules.."
- Reorder rules using arrow buttons
Rule (applied in the order shown)
- Black
- Red
- Green
How these excel formulae work
You will find an explanation here:
Highlight overlapping date ranges using conditional formatting in excel
Download excel sample file for this tutorial.
Visualize date ranges.xls
(Excel 97-2003 Workbook *.xls)
Related articles:
Find overlapping date ranges in excel
Highlight overlapping date ranges using conditional formatting in excel
Calendar with scheduling in excel 2007 (vba)
Functions in this article:
SUMPRODUCT(array1, array2, )
Returns the sum of the products of the corresponding ranges or arrays
MONTH(serial_number) returns the month, a number from 1 (January) to 12 (December)
ROWS(array) returns the number of rows in a reference or an array








December 29th, 2010 at 5:05 pm
Hi.
So this is exactly what i am looking for to get my Staff Leave Calendar going except that my table (data sheet) is on another worksheet in the same workbook as the calendar. How can i amend the formula so that it works for me?
December 29th, 2010 at 6:22 pm
Lorne,
Conditional formatting can´t reference cells in other sheets. There is a workaround, use named ranges.