Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I guess the OP declaration of ...I would like to count a column that
consists of even and odd numbers ... means nothing then. Your argument, while technically correct, is unnecessary, as, per the OP, the column will contain either even numbers or odd numbers. -- ** John C ** "Harlan Grove" wrote: "T. Valko" wrote... Try these: Even numbers: =SUMPRODUCT(--(MOD(A1:A10,2)=0)) This one's OK up to MOD's capabilities. Odd numbers: =SUMPRODUCT(--(MOD(A1:A10,2)0)) .... This isn't. Technically, numbers with fractional parts aren't either even or odd. Even if 1.5 should be considered odd and 2.125 even, your formula would treat both as odd. The correct formula for odd integers is =SUMPRODUCT(--(MOD(A1:A10,2)=1)) Then there's the problem that Excel's MOD function isn't reliable. Among all applications currently supported which handle double precision math, Excel's MOD function has a uniquely artificially curtailed domain. Safer to use =SUMPRODUCT(--(A1:A10-2*INT(A1:A10/2)=0)) for even integers =SUMPRODUCT(--(A1:A10-2*INT(A1:A10/2)=1)) for odd integers |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
COUNTIF a cell value is between two numbers | Excel Worksheet Functions | |||
countif colored numbers | Excel Worksheet Functions | |||
Embed a countif function in subtotal function? | Excel Worksheet Functions | |||
COUNTIF for range of numbers | Excel Discussion (Misc queries) | |||
Countif for numbers between x and y | Excel Worksheet Functions |