Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Shading Based on Odds and Evens.
by Allen Wyatt
(last updated November 21, 2015)
If you have a series of values in a range of cells, you might want to use different formatting to differentiate the odd numbers from the even numbers. The way you do this is through the use of the Conditional Formatting feature in Excel. Follow these steps:
Figure 1. The New Formatting Rule dialog box.
With this conditional formatting applied, if the cell is odd it will be one color and if even it will be another. If the cell contains text, the cell will be uncolored, meaning it will have the color of the cell before you added the conditional formatting. The conditional formatting overrides any formatting you put on the cell, so even if you try to change the cell color via the tools on the ribbons, the conditional formatting takes precedence.
The MOD function isn't the only thing you can use in your formula. If you want to determine whether the cell contains an odd value (step 6), you could use the following:
Similarly, if you want to determine if the cell contains an even value (step 11), you could use the following:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6260) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Shading Based on Odds and Evens.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Need to have your worksheet printout start on a new page every time a value in a column changes? There are a couple of ways ...Discover More
Sometimes the hardest part of getting your conditional formatting rules to work properly is figuring out the proper way to ...Discover More
Need to know if a particular cell contains a date value? Excel doesn't have a worksheet function to determine this ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.