Odd or Even Row Formulas in Excel

Author: | Edits: don

Formulas to determine if the current cell is odd or even; this allows you to perform specific calculations, value incrementing, row shading using conditional formatting, and more.

Sections:

Odd & Even Row Formula (Newer Excel Versions)

Odd & Even Row Formula (Excel 2002 and Earlier)

Notes

Odd & Even Row Formula (Newer Excel Versions)

Check if current row is odd:

=ISODD(ROW())

ISODD is the function that checks if a number is odd or even. Returns TRUE for odd rows and FALSE for even rows.

ROW returns the row number of a cell. If you leave the ROW function empty, without an argument, like in this example, it references the row where you put the function; however, you can also include a range reference in the function and it will then return the number of the row for that range reference.

Check if current row is even:

=ISEVEN(ROW())

ISEVEN is the function that checks if a number is odd or even. Returns FALSE for odd rows and TRUE for even rows.

ROW returns the row number of a cell. If you leave the ROW function empty, without an argument, like in this example, it references the row where you put the function; however, you can also include a range reference in the function and it will then return the number of the row for that range reference.

One Formula to Check Even/Odd Rows

It doesn't matter which one of the above formulas you use, both of them will return alternating TRUE/FALSE values for a range.

If you input them into Excel and copy them down, it will look like this: If you want to do something specific with odd/even rows, you can wrap the above functions inside of an IF statement like this:

=IF(ISEVEN(ROW()),"Even","Odd")

This example outputs Even for even rows and Odd for odd rows, but you can make it do whatever you want. Odd & Even Row Formula (Excel 2002 and Earlier)

In earlier versions of Excel, you didn't have the ISODD and ISEVEN functions and you had to use the MOD() function along with a little programming type logic.

=IF(MOD(ROW(),2)=0,"Even","Odd")

ROW function returns the row of a cell. If you leave the ROW function empty, without an argument, it references the row where you put the function; however, you can also include a range reference in the function and it will then return the number of the row for that range reference.

MOD is the function that really does the magic here and, though it looks scary, it's pretty simple. The MOD function returns the remainder after a number is divided by another number. In this case it will divide the current row number by 2; if it is able to divide the number by 2 without having a remainder, then you know it is an even number, and, in this case, an even row.

The formula logic knows that the row is even because, it takes the result of the MOD function, the remainder after division, and then checks if it is equal to 0 or not. If there is no remaineder, then that is the same as 0, which is checked for in the =0 part of the formula, and Excel will output the TRUE argument from the IF statement. Output True/False Simple Formula

You don't have to use an IF statement if you just want to get TRUE and FALSE values in Excel.

=MOD(ROW(),2)=0

Change the 0 to a 1 if you want it to return false for even rows. Increment a Value Every X Number of Rows in Excel

Shade Every Other Row in Excel Quickly

Sum Values from Every X Number of Rows in Excel

Question? Ask it in our Excel Forum

Excel Function: IF(), ISEVEN(), ISODD(), MOD(), ROW()

Similar Content on TeachExcel
Convert Column Number to Letter Using a Formula in Excel
Tutorial: How to get a column letter from a number in Excel using a simple formula. This is an ...
Complex Structured References (Table Formulas) in Excel
Tutorial: How to use complex structured references, table formulas, in Excel. If you don't already...
Calculate Hours Worked - Day or Night Shift & Breaks in Excel
Tutorial: Single simple formula to calculate the hours worked for a day shift or night shift and inc...
Determine a Cell's Color with this UDF - Outputs as Text or the Index Number in Excel
Macro: This free Excel UDF allows you to output the color of a cell in text format or as that col...
Count The Number of Words in a Cell or Range of Cells in Excel - UDF
Macro: Count words in cells with this user defined function (UDF). This UDF allows you to count t...
Count The Number of Words in a Cell or Range of Cells in Excel - With User-Specified Delimiter / Separator - UDF
Macro: UDF to count the number of words in a cell or range with a user-specified delimiter. ...
Tutorial Details
Excel Function: IF(), ISEVEN(), ISODD(), MOD(), ROW()