How to write a formula to identify even and odd numbers from two cells (A1 & B1) into one cell (C1)?

arthurz11

Board Regular
Joined
Nov 9, 2007
Messages
162
Office Version
  1. 2021
Platform
  1. Windows
In Cell A1, can be any numbers from 0 to 3.
In Cell B1, can be any numbers from 0 to 3.
In Cell C1, the answer should be any four options. Depending on the numbers entered in A1 and B1:
EE, or OO, or EO, or OE.
E for Even and O for Odd number.
Example:
If A1 = 1 and B1 = 1. C1 the answer is "OO"
If A1 = 2 and B1 = 2. C1 the answer is "EE"
If A1 = 2 and B1 = 3. C1 the answer is "EO"
If A1 = 1 and B1 = 2. C1 the answer is "OE"
If A1 = 0 and B1 = 2. C1 the answer is "EE" (Note: zero is considered an even number)

In Cell C1, I have used =IF(AND(MOD(A1,2)=1,MOD(B1,2)=1),"OO","EE") but this "ONLY" works if both numbers or even or odd.
How do I combine the formula to include EO or OE? So if it's not EE or OO, it can be EO. or vice versa, OE?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi, you could try this:
Book1
ABC
111OO
222EE
323EO
412OE
502EE
Sheet1
Cell Formulas
RangeFormula
C1:C5C1=CONCAT(IF(MOD(A1:B1,2)=0,"E","O"))
 
Last edited:
Upvote 0
Another option
Excel Formula:
=CONCAT(IF(ISEVEN(--A2:B2),"E","O"))
 
Upvote 0
Hi, you could try this:
Book1
ABC
111OO
222EE
323EO
412OE
502EE
Sheet1
Cell Formulas
RangeFormula
C1:C5C1=CONCAT(IF(MOD(A1:B1,2)=0,"E","O"))
If you can show me how to combine all four formulas into one in Cell C1. That would be great. I just want to use three cells. In Cell A1 and in Cell B1, you just input any numbers from 0 to 3, then it will give me the answer in Cell C1: EE for two even numbers. OO for two odd numbers. EO for one even and one odd number. OE for one odd number and one even number. Thanks for your work. But I still just need to use "only" three cells.
 
Upvote 0
Hi, you can use that one formula (or Fluffs). Did you try it?
 
Upvote 0
Another option
Excel Formula:
=CONCAT(IF(ISEVEN(--A2:B2),"E","O"))
If you can show me how to combine all four formulas into one in Cell C1. That would be great. I just want to use three cells. In Cell A1 and in Cell B1, you just input any numbers from 0 to 3, then it will give me the answer in Cell C1: EE for two even numbers. OO for two odd numbers. EO for one even and one odd number. OE for one odd number and one even number. Thanks for your work. But I still just need to use "only" three cells.
 
Upvote 0
That formula & the one from FormR do just use 3 cells.
 
Upvote 0
Hi, you could try this:
Book1
ABC
111OO
222EE
323EO
412OE
502EE
Sheet1
Cell Formulas
RangeFormula
C1:C5C1=CONCAT(IF(MOD(A1:B1,2)=0,"E","O"))
I figured out how your formula worked because of the range (A1:B1). I put the two cells adjacent to one another (A1 and B1) to make it easier for Mr. Excel to write the formula. BUT on my actual worksheet, the two cells are farther apart. For example, One cell is Cell A1. The other cell is in Cell Z1. (not Cell B1 like I mentioned earlier). Anyway, I didn't think it would make a difference if I just said Cell A1 and Cell B1 but it does.

For example: In cell A1 (input number 0 and 3). In cell Z1 (input number 0 to 3). Let's say Cell A2 has the answer. EE, OO, EO, or OE (depending on the input numbers in Cell A1 and in Cell Z1. I hope this is a better clarity than before. So can it be done?
 
Upvote 0
How about
Excel Formula:
=IF(ISEVEN(A1),"E","O")&IF(ISEVEN(Z1),"E","O")
 
Upvote 0
Solution

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top