odd numbers

Runes

New Member
Joined
Jul 26, 2009
Messages
8
I have a large table in which I have three columns of numbers. I only use even numbers so I need a formula for my conditional formatting to look for any odd numbers in these columns and turn the cell red when it finds one. Can you suggest anything?
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Hello Runes, welcome to MrExcel,

You can use MOD function, e.g. if your numbers are in columns A to C then just select those 3 columns and use conditional formatting with "formula is" option and this formula

=MOD(A1,2)

select red formatting > OK
 

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,658
=MOD(A1,2) works good, but fails within a big numbers, say if A1 is equal to 1000000001

There is the formula for the full range of Excel numbers:
=TRUNC(A1)/2<>TRUNC(TRUNC(A1)/2)

You cal also use the Analysis ToolPak Add-In's function IsEven() in this manner: =Not(IsEven(A1))
But such Add-In should be checked in the listbox of menu Tools > Add-Ins
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
If you have numbers that large then I think the simplest alternative would be:

=A1<>EVEN(A1)

Note that you can't use Analysis ToolPak functions like ISEVEN in conditional formatting
 

phxsportz

Well-known Member
Joined
Jun 11, 2006
Messages
1,985
Long debate yesterday over Odd/Even numbers.. Shows the shortcomings of how excel handles Even and Odd numbers...

Sheet3

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Arial,Arial; FONT-SIZE: 10pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 170px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt; FONT-WEIGHT: bold"><TD> </TD><TD>J</TD><TD>K</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">5</TD><TD style="BACKGROUND-COLOR: #ffcc99"># to Evaluate</TD><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #ffff99">12.5</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">6</TD><TD style="BACKGROUND-COLOR: #ffcc99">ISEVEN() says it's Even ?</TD><TD style="TEXT-ALIGN: right; BACKGROUND-COLOR: #ccffcc">TRUE </TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">7</TD><TD style="BACKGROUND-COLOR: #ffcc99">Even() say it's Even ?</TD><TD style="TEXT-ALIGN: right; BACKGROUND-COLOR: #ff0000; COLOR: #ffffff; FONT-WEIGHT: bold">FALSE</TD></TR></TBODY></TABLE>
<TABLE style="BORDER-BOTTOM-STYLE: groove; BORDER-BOTTOM-COLOR: #00ff00; BORDER-RIGHT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-TOP-STYLE: groove; COLOR: #000000; BORDER-RIGHT-COLOR: #00ff00; FONT-SIZE: 10pt; BORDER-LEFT-STYLE: groove; BORDER-LEFT-COLOR: #00ff00"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-FAMILY: Arial; FONT-SIZE: 9pt" border=1 cellSpacing=0 cellPadding=2><TBODY><TR style="BACKGROUND-COLOR: #cacaca; FONT-SIZE: 10pt"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>K6</TD><TD>=ISEVEN(K5)</TD></TR><TR><TD>K7</TD><TD>=EVEN(K5)=K5</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>

http://www.mrexcel.com/forum/showthread.php?t=404266&goto=newpost
 

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,658
If you have numbers that large then I think the simplest alternative would be:

=A1<>EVEN(A1)

Note that you can't use Analysis ToolPak functions like ISEVEN in conditional formatting
Hi Barry,

Such formula returns the different result than =Not(ISEVEN(A1)) and than of mine, for example if A1 = 2.5 or A1 = -2.5 etc.

Taking into account that ISEVEN() now is integrated into the current version of Excel 2007 and it not requires the Analysis ToolPak Add-In, I think that the compatibility with ISEVEN() would be the de-facto rule.

Regards,
Vladimir

P.S. Evening Phxsportz, thanks for your inputs in both debates!
 
Last edited:

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
You could get into endless debates about this I think....

My assumption was that numbers would be integers. Once that doesn't hold I think you'd need to make the definition of odd or even very clear.
 

phxsportz

Well-known Member
Joined
Jun 11, 2006
Messages
1,985
LOL... This is the same direction that yesterdays thread took... heh

(y)
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
OK, I'll take a stand......:cool:

If only integers can be odd then I suppose the best formula here would be

=A1=ODD(A1)
 

Forum statistics

Threads
1,082,018
Messages
5,362,702
Members
400,686
Latest member
Aakash

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top