Conditional Formatting IF Statement for Odd/Even

JTL9161

Well-known Member
Joined
Aug 29, 2012
Messages
567
Office Version
  1. 365
Platform
  1. Windows
I am trying to write a conditional formatting with an if statement

I have 2 rows of numbers (Row 1 Col A-Q and Row 2 A-Q)

I have a 3rd row (Row 4) with odd/even numbers.

What I am trying to write is IF (CELL A4 IS ODD then just highlight the cell A1) and IF (CELL A4 IS EVEN then just highlight the cell A2)

Everything I see online is highlighting the number using ISEVEN and ISODD.

Thank you in advance,
James
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
If I am understanding you correctly (I am note sure what part rows 1 and 2 play in this), you should just need two Conditional Formatting rules.

First, one on cell A1 with the Conditional Formatting formula of:
Excel Formula:
=ISODD(A4)
and then one on cell A2 with the Conditional Formatting formula of:
Excel Formula:
=ISEVEN(A4)
 
Upvote 0
Try:
Book1
ABCD
1highlight if oddhighlight if oddhighlight if oddhighlight if odd
2highlight of even highlight of even highlight of even highlight of even
3
4732145
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:D2Expression=MOD(A4,2)<>0textNO
A1:D1Expression=MOD(A4,2)=0textNO
 
Upvote 0
Try:
Book1
ABCD
1highlight if oddhighlight if oddhighlight if oddhighlight if odd
2highlight of even highlight of even highlight of even highlight of even
3
4732145
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:D2Expression=MOD(A4,2)<>0textNO
A1:D1Expression=MOD(A4,2)=0textNO
No need to use the MOD function, as Excel already has an ISEVEN and ISODD functions (no sense in recreating the wheel).
 
Upvote 0
Yes, you're correct. those functions slipped my mind.
Might be time for a break (the OP actually mentioned those functions in the original post)! ;)
I have been known to do this too, and I have to remind myself to step away from the computer from time-to-time!
 
Upvote 0
Thank you both for your input. I will give them a try.
 
Upvote 0

Forum statistics

Threads
1,215,568
Messages
6,125,599
Members
449,238
Latest member
wcbyers

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