Archive of Mr Excel Message Board


Back to Forms in Excel VBA archive index
Back to archive home

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


Check out our Excel Resources

Re: Determining Whether a Value is Odd or Even

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

=======


Thanks for the Help

Posted by David Holstein on January 16, 2002 1:30 AM
Thanks for that, works well. I don't think ISEVEN is available in Excel: David --



ISEVEN/ISODD

Posted by Aladin Akyurek on January 16, 2002 1:47 AM
> 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

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



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

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



This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.