ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Function for odd even numbers (https://www.excelbanter.com/excel-worksheet-functions/254721-function-odd-even-numbers.html)

petedacook

Function for odd even numbers
 
Is there a function to determine if a cell has odd or even numbers? This
would be used in an "IF" statement.

Thanks,

pete K

Eduardo

Function for odd even numbers
 
Hi,
take a look to the Microsoft help, function ISODD

Returns TRUE if number is odd, or FALSE if number is even.

Syntax

ISODD(number)



"petedacook" wrote:

Is there a function to determine if a cell has odd or even numbers? This
would be used in an "IF" statement.

Thanks,

pete K


Joe User[_2_]

Function for odd even numbers
 
"Eduardo" wrote:
take a look to the Microsoft help, function ISODD


Good answer. That would be my choice.

But if you do not want to rely on the ATP (Excel 2003 and earlier), you
might try the following:

=IF(MOD(A1,2), "odd", "even")

There are bugs in MOD. For example, try MOD(123456789012345,2). So it
might be prudent to use this alternative:

=IF(INT(A1/2)*2 < A1, "odd", "even")


----- original message -----

"Eduardo" wrote:
Hi,
take a look to the Microsoft help, function ISODD

Returns TRUE if number is odd, or FALSE if number is even.

Syntax

ISODD(number)



"petedacook" wrote:

Is there a function to determine if a cell has odd or even numbers? This
would be used in an "IF" statement.

Thanks,

pete K


Teethless mama

Function for odd even numbers
 
=CHOOSE(ISODD(A1)+1,"even","odd")


"petedacook" wrote:

Is there a function to determine if a cell has odd or even numbers? This
would be used in an "IF" statement.

Thanks,

pete K


Rick Rothstein

Function for odd even numbers
 
You should also be able to protect against the MOD bug by simply looking at
the last digit (which is a range of digits that MOD has no trouble with)...

=IF(MOD(RIGHT(B3),2),"Odd","Even")

--
Rick (MVP - Excel)


"Joe User" <joeu2004 wrote in message
...
"Eduardo" wrote:
take a look to the Microsoft help, function ISODD


Good answer. That would be my choice.

But if you do not want to rely on the ATP (Excel 2003 and earlier), you
might try the following:

=IF(MOD(A1,2), "odd", "even")

There are bugs in MOD. For example, try MOD(123456789012345,2). So it
might be prudent to use this alternative:

=IF(INT(A1/2)*2 < A1, "odd", "even")


----- original message -----

"Eduardo" wrote:
Hi,
take a look to the Microsoft help, function ISODD

Returns TRUE if number is odd, or FALSE if number is even.

Syntax

ISODD(number)



"petedacook" wrote:

Is there a function to determine if a cell has odd or even numbers?
This
would be used in an "IF" statement.

Thanks,

pete K




All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com