Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Shading Based on Odds and Evens.
by Allen Wyatt
(last updated August 24, 2017)
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 Conditional Formatting 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 toolbar, the conditional formatting takes precedence.
It is interesting to note that if you have the Analysis ToolPak enabled in Excel, you might be tempted to use the ISODD and ISEVEN functions in the conditional format. These functions cannot apparently be used with conditional formatting. If you try to do so, Excel generates an error that says, "You may not use references to other worksheets or workbooks for Conditional Formatting criteria." The best bet is to use the MOD function, as described above.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2767) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Shading Based on Odds and Evens.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Need to have a sound played if a certain condition is met? It is rather easy to do if you use a user-defined function to ...Discover More
If you want to highlight cells that contain certain characters, you can use the conditional formatting features of Excel ...Discover More
If you need to shade alternating rows in a data table, you'll want to examine how you can accomplish the task with ...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 menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.