ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   identify even numbers with a "1" and odd numbers with a "0" (https://www.excelbanter.com/excel-worksheet-functions/27430-identify-even-numbers-%221%22-odd-numbers-%220%22.html)

sutchpain

identify even numbers with a "1" and odd numbers with a "0"
 
I need a formula that will return a value of '1' if the number in another
column is 'even' (divisible by 2) and a '0' if it is not. I used the
'countif' function in a single cell once before, but can't remember how. Have
a work-around that uses countif 'true value in one column and a 3rd column
with 'if' function to return a '1' if true and '0' if odd...but can't seem to
make it work in one cell. It was 'easier' before, and used 'counif'. Any good
ideas out there? Thanks.

Biff

Hi!

Assume your numbers are in column D.

If you have the Analysis ToolPak add-in installed:

=--ISEVEN(D1)

If you try the above formula and get #NAME? as a result, it means that you
probably don't have the ATP installed.

If you don't have the ATP installed:

=--(MOD(D1,2)=0)

Copy down as needed.

Biff

"sutchpain" wrote in message
...
I need a formula that will return a value of '1' if the number in another
column is 'even' (divisible by 2) and a '0' if it is not. I used the
'countif' function in a single cell once before, but can't remember how.
Have
a work-around that uses countif 'true value in one column and a 3rd column
with 'if' function to return a '1' if true and '0' if odd...but can't seem
to
make it work in one cell. It was 'easier' before, and used 'counif'. Any
good
ideas out there? Thanks.




Dave Peterson

One mo
=mod(a1+1,2)



sutchpain wrote:

I need a formula that will return a value of '1' if the number in another
column is 'even' (divisible by 2) and a '0' if it is not. I used the
'countif' function in a single cell once before, but can't remember how. Have
a work-around that uses countif 'true value in one column and a 3rd column
with 'if' function to return a '1' if true and '0' if odd...but can't seem to
make it work in one cell. It was 'easier' before, and used 'counif'. Any good
ideas out there? Thanks.


--

Dave Peterson


All times are GMT +1. The time now is 10:12 AM.

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