MrExcel Consulting
Your One Stop for Excel Tips & Solutions

Determining Whether a Value is Odd or Even


Posted by David Holstein on January 16, 2002 12:02 AM

Hi,

I need to determine whether a PARTICULAR day is ODD or EVEN. In cell A1 I have =DAY(TODAY()) which generates the number for that day. From there I need to point a formula to they cell to determine Odd or Even. I have considered a series of IF formula's, but am troubled by the fact that there is limitation of 7 IF statements in one formula.

I simply want the formula to equate to either ODD or EVEN.

Does anybody know of a better solution. Any help much appreciated.

Regards
David

Posted by Aladin Akyurek on January 16, 2002 12:41 AM

David --

It's:

=IF(ISEVEN(DAY(TODAY())),"EVEN","ODD") if you have ISEVEN available.

Otherwise, use:

=IF(MOD(DAY(TODAY()),2)=0,"EVEN","ODD")

Also nice & useful:

=ISEVEN(DAY(TODAY()))+0

=(MOD(DAY(TODAY()),2)=0)+0

where a result of 1 must be treated as EVEN and 0 as ODD (You may reverse it if you like).

Aladin

=======

Posted by David Holstein on January 16, 2002 1:30 AM

Thanks for the Help

Thanks for that, works well. I don't think ISEVEN is available in Excel: David --


Posted by Aladin Akyurek on January 16, 2002 1:47 AM

ISEVEN/ISODD

> Thanks for that, works well.

You're welcome.

> I don't think ISEVEN is available in Excel

But it is (Anyway in Excel 2000). What follows is from the Help file of Office 2000 on the Mac:

----------------------------------------------
ISEVEN
See Also
Returns TRUE if number is even, or FALSE if number is odd.
If this function is not available, run the Value Pack Installer to install the Analysis ToolPak. After you install the Analysis ToolPak, you must enable it by using the Add-Ins command on the Tools menu.
How?
Syntax
ISEVEN(number)
Number is the value to test. If number is not an integer, it is truncated.
Remarks
If number is nonnumeric, ISEVEN returns the #VALUE! error value.
Examples
ISEVEN(-1) equals FALSE
ISEVEN(2.5) equals TRUE
ISEVEN(5) equals FALSE

----------------------------------------------


Posted by Mark W. on January 16, 2002 8:41 AM

ISEVEN and ISODD are available via the Analysis ToolPak (nt)