Highlight odd/even months
Color odd months
Conditional formatting formula:
Explaining CF formula in cell B6
Step 1 - Calculate number of month
The MONTH function returns a number representing a month based on a date. 1 = January, 2 = February ... 12 = December.
MONTH($B6)
becomes
MONTH(1/1/2008)
becomes
MONTH(39448)
and returns 1. 1 = January.
Step 2 - Calculate remainder
The MOD function returns the remainder after a number is divided by a divisor.
MOD(MONTH($B6),2)
becomes
MOD(1, 2)
and returns 1.
In cell B10 the date changes to 2/2/2008. MOD(MONTH($B6),2) becomes MOD(2,2) and returns 0 (zero). This cell is not highlighted with this specific color.
How to apply conditional formatting
- Select cell range B6:D19
- Go to tab "Home" on the ribbon
- Click on "Conditional Formatting" button
- Click on "New Rule.."
- Select "Use a formula to determine which cells to format"
- Type =MOD(MONTH($B6),2) in field "Format values where this formula is true:"
- Then click on "Format..." button
- Go to tab "Fill"
- Pick a color
- Click OK button
- Click OK button to return to Excel.
Color even months
Conditional formatting formula:
The NOT function returns the boolean opposite to the given argument. The numerical equivalent to boolean value TRUE is 1 and FALSE is 0 (zero).
Color odd years
Conditional formatting formula:
The YEAR function returns the year based on a date.
Color even years
Conditional formatting formula:
Border between months
Conditional formatting formula:
Border between years
Conditional formatting formula:
Download excel file for this tutorial.
Highlight every even month.xlsx
(Excel 2007 Workbook *.xlsx)
Highlight overlapping date ranges using conditional formatting
The image above demonstrates a conditional formatting formula that colors a record if there is at least one record that […]
Highlight records based on overlapping date ranges and a condition
adam asks: Hi, I have a situation where I want to count if this value is duplicate and if it […]
Highlight overlapping date ranges using conditional formatting
The image above demonstrates a conditional formatting formula that colors a record if there is at least one record that […]
Count Conditionally Formatted cells
This article explains how to count cells highlighted with Conditional Formatting (CF). The image above shows data in cell range […]
Highlight records based on overlapping date ranges and a condition
adam asks: Hi, I have a situation where I want to count if this value is duplicate and if it […]
Highlight dates in a date range
Question: How do I highlight dates that meet criteria using conditional formatting? Table of contents Highlight values in a column […]
This post demonstrates how to highlight records with the closest value to a criterion, you can also choose to highlight […]
One Response to “Highlight odd/even months”
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
That's how to explain!!!
Congratulations