Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 27
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,276
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 905
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MID and FIND Function for Numbers alxcl Excel Worksheet Functions 2 July 10th 08 10:46 AM
Function for + and - numbers slschram Excel Worksheet Functions 4 February 24th 07 01:42 AM
does an IF function only look up numbers & not text? CAPGirl Excel Discussion (Misc queries) 2 October 26th 06 08:20 PM
Function to write out numbers Mark Williams Excel Worksheet Functions 1 July 22nd 05 08:35 PM
Words > Numbers (i.e. Vanity Phone Numbers) function Don Excel Worksheet Functions 1 December 29th 04 06:10 PM


All times are GMT +1. The time now is 06:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"