How do you determine whether a value is odd or even? You may need that information to perform custom rounding calculations, or you may simply need to generate a list of even-numbered street addresses for your sales staff.

To determine whether an integer is odd or even, use the MOD function, which takes the form =MOD(value,2). This expression divides "value" by 2 and returns the remainder, if any. Therefore, if this formula returns 1, then "value" is odd; if this formula returns 0, then "value" is positive. To display either "odd" or "even," you could use a formula in the form =IF(MOD(cellref,2)=1,"Odd","Even"). Just replace "cellref" with the name of the cell containing the value you want to evaluate. You can use the MOD function in association with conditional formatting to apply shading (or another formatting attribute) to the odd or even rows in a range. Select the rows you want to format on a conditional basis and then go to Format | Conditional Formatting. Change the setting under Condition 1 from Cell Value Is to Formula Is. Then enter the expression =MOD(ROW(),2)=1, which will evaluate to true for odd rows. Click the Format button and choose the formatting you want to apply to the odd rows and then click OK.

With this approach, your odd-numbered rows will always display special formatting, regardless of whether you insert or delete rows from the range you originally formatted.

Created Date: 04/25/2002  Last Reviewed: 04/25/2002  Rev. Date: