identifying odd/even numbers

  • Thread starter Thread starter rdy4trvl
  • Start date Start date
R

rdy4trvl

Is there a formula or easy way way for excel to identify if a number
(thousands of numbers) is odd or even?
Thanks
 
One way:

Even:

=MOD(A1,2)=0

Odd:

=MOD(A1,2)=1

If you load the Analysis Toolpak Add-in, you can use the ISODD() or
ISEVEN() functions. Note that ISODD works a bit differently, since
it truncates numbers, so if A1 = 3.5

=MOD(A1,2)=1 ==> FALSE
=ISODD(A1) ==> TRUE
 
The very simplest way is to divide by 2 and evaluate the result. For a value
in A1, this formula would work:

=MOD(A1,2)

The result would be 1 for an odd number, and zero for an even number.

If you want 1 to represent even, use:

=1-MOD(A1,2)

If you want a more traditional TRUE/FALSE or ODD/EVEN, try:

=IF(MOD(A1,2),"ODD","EVEN")

(TRUE and FALSE are special boolean values, so they don't need the quotes)
--
HTH -

-Frank Isaacs
Dolphin Technology Corp.
http://vbapro.com
 
J.E. McGimpsey said:
One way:

Even:

=MOD(A1,2)=0

Odd:

=MOD(A1,2)=1
....

Caveat: it depends on the scale of the numbers to be tested. If A2 > 2^28
(268,435,456), MOD will return #NUM!. This is a known bug in Excel which
Microsoft insists on considering a feature (since they doesn't admit this is
a bug in http://support.microsoft.com/default.aspx?scid=kb;en-us;119083,
it's ipso facto intended, if bizarre and inexplicable, functionality). In
the spirit of this KB article's work-around, it may be safer to use

Even: =INT(A1/2)=A1/2

Odd: =INT(A1/2)<>A1/2
 
Back
Top