ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Even and Odd Numbers (https://www.excelbanter.com/excel-worksheet-functions/28502-even-odd-numbers.html)

Andrew

Even and Odd Numbers
 
Hi

I need a formula that will Add 2 to the numbers in Column A if they are even
and Minus Two if they are Odd.

Thanks in advance

KL

Try these:

=A1+2-4*MOD(A1,2)
=A1+2*-1^MOD(A1,2)
=A1+IF(MOD(A1,2),-2,2)
=A1+CHOOSE(1+MOD(A1,2),2,-2)

Regards,
KL


"Andrew" wrote in message
...
Hi

I need a formula that will Add 2 to the numbers in Column A if they are
even
and Minus Two if they are Odd.

Thanks in advance




mangesh_yadav


Use:

=A1+IF(MOD(A1,2)=0,2,-2)

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=375173


Bernard Liengme

Try this =A1+ISEVEN(A1)*2-ISODD(A1)*2
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Andrew" wrote in message
...
Hi

I need a formula that will Add 2 to the numbers in Column A if they are
even
and Minus Two if they are Odd.

Thanks in advance





All times are GMT +1. The time now is 02:09 PM.

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